A method, apparatus, computer device and storage medium for generating a neural network
By constructing multiple search spaces to automatically search for neural network structures, the problem of relying on human experience in building neural networks in existing technologies is solved, thereby improving the accuracy and performance of deep learning tasks.
Patent Information
- Application Number
- CN202111314991.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-08
- Publication Date
- 2025-11-18
- Estimated Expiration
- 2041-11-08
AI Technical Summary
In existing technologies, neural networks built based on human experience have performance limitations in terms of accuracy and resource consumption in deep learning tasks.
Multiple search spaces are constructed, including search spaces for preset network structure units, downsampling processing units, and neural network structure size information. Diverse neural network structures are obtained through automated search. The target neural network is generated by combining the training dataset and the expected results.
It improves the diversity of neural network structures and the processing performance of deep learning tasks, and can generate target neural networks with the expected accuracy.
Smart Images

Figure CN113988272B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of deep learning technology, and more specifically, to a method, apparatus, computer device, and storage medium for generating neural networks. Background Technology
[0002] For deep learning tasks, such as image classification, image detection, or image segmentation, it is often necessary to jointly construct deep neural networks using different types of network architectures. Each network architecture has many options, and combining different types of network architectures produces neural networks with varying structures. The performance of these neural networks in the corresponding deep learning tasks depends on the quality of the network architecture. Currently, the combination of different network architectures mainly relies on manually building neural networks, depending on human experience. The performance of these neural networks, after training, in terms of accuracy and resource consumption, needs improvement. Summary of the Invention
[0003] This disclosure provides at least one method, apparatus, computer device, and storage medium for generating neural networks.
[0004] In a first aspect, embodiments of this disclosure provide a method for generating a neural network, including:
[0005] A first search space corresponding to a preset network structure unit, a second search space corresponding to a downsampling processing unit, and a third search space corresponding to the size information of the neural network structure are determined. The preset network structure unit and the downsampling processing unit are used to construct the neural network structure.
[0006] Based on the first search space, the second search space, and the third search space, as well as the training dataset corresponding to the preset deep learning task, a network structure search is performed to obtain the target neural network structure corresponding to the expected result of the deep learning task.
[0007] Based on the target neural network structure, a target neural network for processing deep learning tasks is generated.
[0008] In this aspect, a search space for searching neural network structures is pre-constructed. Each search space contains multiple networks or various size information. Therefore, the multiple search spaces constructed in this aspect provide a large search space. The network structure corresponding to the preset network structure unit is searched from the first search space, the network structure corresponding to the downsampling processing unit is searched from the second search space, and the size information of the neural network structure is searched from the third search space. Searching for network structures within a large search space allows for the acquisition of various neural network structures, increasing the diversity of the searched neural network structures and thus improving the processing performance of the final target neural network for deep learning tasks. Furthermore, based on the searched network structures and size information, a neural network structure is constructed. Combined with the training dataset corresponding to the preset deep learning task and the expected results of the deep learning task, the target neural network structure corresponding to the expected results of the deep learning task can be obtained, i.e., the target neural network with the expected accuracy can be obtained.
[0009] In one optional implementation, the first search space includes at least two of the following: convolutional structural units, self-attention-based encoder-decoder structural units, and multilayer perceptron (MLP) structural units.
[0010] In one optional implementation, the second search space includes a local downsampling unit, a global downsampling unit, and a global-local downsampling unit, wherein the local downsampling unit is used to sample local context information, the global downsampling unit is used to sample global context information, and the global-local downsampling unit is used to sample both global and local context information.
[0011] In one optional implementation, the local downsampling unit includes a first convolution operator for performing convolution operations;
[0012] The global downsampling unit includes a first processing unit based on a self-attention mechanism and a second convolution operator for performing convolution operations on the data input to the first processing unit.
[0013] The global-local downsampling unit includes a second processing unit based on a self-attention mechanism and a third convolution operator for performing convolution operations on the data input to the second processing unit.
[0014] In one optional implementation, the network structure search based on the first search space, the second search space, and the third search space, as well as the training dataset corresponding to a preset deep learning task, includes:
[0015] Construct a target search space based on the first search space, the second search space, and the third search space;
[0016] Multiple candidate neural network structures are determined based on the target search space; wherein each candidate neural network structure includes at least one preset network structure unit selected from the first search space and at least one downsampling processing unit selected from the second search space, and the size information of each preset network structure unit in each candidate neural network is the size information selected from the third search space;
[0017] Construct a corresponding candidate neural network based on the aforementioned candidate neural network structure;
[0018] The processing result of the candidate neural network for the deep learning task is determined using the training dataset corresponding to the preset deep learning task.
[0019] With the goal of minimizing the difference between the processing result of the candidate neural network on the deep learning task and the expected result, a target neural network structure is searched in the target search space based on the candidate neural network structure.
[0020] In one optional implementation, the step of searching for the target neural network structure within the target search space based on the candidate neural network structure includes:
[0021] Based on the processing results of each target candidate neural network structure in the partial candidate neural network structure for the deep learning task, the first selection probability of each preset network structure unit, the second selection probability of each downsampling processing unit, and the third selection probability of the size information corresponding to each preset network structure unit are updated respectively.
[0022] Based on the updated first selection probability, second selection probability and third selection probability, network structure search is performed to reselect multiple new target candidate neural network structures;
[0023] If the differences between the processing results of the multiple new target candidate neural network structures for the deep learning task and the expected results do not meet the first preset condition, the process returns to the step of updating the selection probability.
[0024] In one optional implementation, the step of updating the first selection probability of each preset network structure unit, the second selection probability of each downsampling processing unit, and the third selection probability of the size information corresponding to each preset network structure unit based on the processing result of each target candidate neural network structure in the partial candidate neural network structure for the deep learning task includes:
[0025] Based on the processing results of each target candidate neural network structure in the partial candidate neural network structure for the deep learning task, the target candidate neural network structure whose accuracy meets the second preset condition is determined.
[0026] Based on the target candidate neural network structure whose accuracy meets the second preset condition corresponding to the processing result, the first selection probability of each preset network structure unit, the second selection probability of each downsampling processing unit, and the third selection probability of the size information corresponding to each preset network structure unit are updated respectively.
[0027] In an optional implementation, the step of searching for the target neural network structure within the target search space based on the candidate neural network structure further includes:
[0028] If the differences between the processing results of the multiple new target candidate neural network structures on the deep learning task and the expected results satisfy the first preset condition, the new target candidate neural network structure corresponding to the differences that satisfy the first preset condition shall be taken as the target neural network structure.
[0029] In one optional implementation, the candidate neural network structure includes multiple feature extraction nodes and multiple downsampling nodes spaced apart; wherein the feature extraction nodes include preset network structure units selected from a first search space; the downsampling nodes include downsampling processing units selected from a second search space; and the size information of each preset network structure unit is selected from a third search space.
[0030] In one optional implementation, generating the target neural network for processing deep learning tasks based on the target neural network structure includes:
[0031] Obtain multiple training samples;
[0032] The target neural network corresponding to the target neural network structure is trained using the training samples until the training cutoff condition is met, thus obtaining the trained target neural network.
[0033] Secondly, embodiments of this disclosure also provide an apparatus for generating a neural network, comprising:
[0034] The search space determination module is used to determine the first search space corresponding to the preset network structure unit, the second search space corresponding to the downsampling processing unit, and the third search space corresponding to the size information of the neural network structure. The preset network structure unit and the downsampling processing unit are used to construct the neural network structure.
[0035] The network structure search module is used to perform network structure search based on the first search space, the second search space, and the third search space, as well as the training dataset corresponding to the preset deep learning task, to obtain the target neural network structure corresponding to the expected result of the deep learning task.
[0036] The neural network generation module is used to generate a target neural network for processing deep learning tasks based on the target neural network structure.
[0037] In one optional implementation, the first search space includes at least two of the following: convolutional structural units, self-attention-based encoder-decoder structural units, and multilayer perceptron (MLP) structural units.
[0038] In one optional implementation, the second search space includes a local downsampling unit, a global downsampling unit, and a global-local downsampling unit, wherein the local downsampling unit is used to sample local context information, the global downsampling unit is used to sample global context information, and the global-local downsampling unit is used to sample both global and local context information.
[0039] In one optional implementation, the local downsampling unit includes a first convolution operator for performing convolution operations;
[0040] The global downsampling unit includes a first processing unit based on a self-attention mechanism and a second convolution operator for performing convolution operations on the data input to the first processing unit.
[0041] The global-local downsampling unit includes a second processing unit based on a self-attention mechanism and a third convolution operator for performing convolution operations on the data input to the second processing unit.
[0042] In one optional implementation, the network structure search module is used to construct a target search space based on the first search space, the second search space, and the third search space;
[0043] Multiple candidate neural network structures are determined based on the target search space; wherein each candidate neural network structure includes at least one preset network structure unit selected from the first search space and at least one downsampling processing unit selected from the second search space, and the size information of each preset network structure unit in each candidate neural network is the size information selected from the third search space;
[0044] Construct a corresponding candidate neural network based on the aforementioned candidate neural network structure;
[0045] The processing result of the candidate neural network for the deep learning task is determined using the training dataset corresponding to the preset deep learning task.
[0046] With the goal of minimizing the difference between the processing result of the candidate neural network on the deep learning task and the expected result, a target neural network structure is searched in the target search space based on the candidate neural network structure.
[0047] In one optional implementation, the network structure search module is used to update the first selection probability of each preset network structure unit, the second selection probability of each downsampling processing unit, and the third selection probability of the size information corresponding to each preset network structure unit based on the processing result of each target candidate neural network structure in the partial candidate neural network structure for the deep learning task.
[0048] Based on the updated first selection probability, second selection probability and third selection probability, network structure search is performed to reselect multiple new target candidate neural network structures;
[0049] If the differences between the processing results of the multiple new target candidate neural network structures for the deep learning task and the expected results do not meet the first preset condition, the process returns to the step of updating the selection probability.
[0050] In one optional implementation, the network structure search module is used to determine the target candidate neural network structure whose accuracy satisfies a second preset condition based on the processing result of each target candidate neural network structure in the partial candidate neural network structure for the deep learning task.
[0051] Based on the target candidate neural network structure whose accuracy meets the second preset condition corresponding to the processing result, the first selection probability of each preset network structure unit, the second selection probability of each downsampling processing unit, and the third selection probability of the size information corresponding to each preset network structure unit are updated respectively.
[0052] In an optional implementation, the network structure search module is further configured to, when the differences between the processing results of the multiple new target candidate neural network structures on the deep learning task and the expected results satisfy the first preset condition, select the new target candidate neural network structure corresponding to the differences that satisfy the first preset condition as the target neural network structure.
[0053] In one optional implementation, the candidate neural network structure includes multiple feature extraction nodes and multiple downsampling nodes spaced apart; wherein the feature extraction nodes include preset network structure units selected from a first search space; the downsampling nodes include downsampling processing units selected from a second search space; and the size information of each preset network structure unit is selected from a third search space.
[0054] In one optional implementation, the neural network generation module is used to acquire multiple training samples;
[0055] The target neural network corresponding to the target neural network structure is trained using the training samples until the training cutoff condition is met, thus obtaining the trained target neural network.
[0056] Thirdly, embodiments of this disclosure also provide a computer device, including: a processor, a memory, and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the computer device is running, the processor communicates with the memory via the bus, and when the machine-readable instructions are executed by the processor, the steps of the first aspect above, or any possible method for generating a neural network in the first aspect, are performed.
[0057] Fourthly, embodiments of this disclosure also provide a computer-readable storage medium storing a computer program that, when executed by a processor, performs the steps of the first aspect or any possible method for generating a neural network in the first aspect.
[0058] For a description of the effects of the aforementioned apparatus, computer equipment, and storage medium for generating neural networks, please refer to the description of the method for generating neural networks described above; it will not be repeated here.
[0059] To make the above-mentioned objects, features and advantages of this disclosure more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0060] To more clearly illustrate the technical solutions of the embodiments of this disclosure, the accompanying drawings used in the embodiments will be briefly described below. These drawings are incorporated in and constitute a part of this specification. They illustrate embodiments conforming to this disclosure and, together with the specification, serve to explain the technical solutions of this disclosure. It should be understood that the following drawings only show some embodiments of this disclosure and should not be considered as limiting the scope. Those skilled in the art can obtain other related drawings based on these drawings without creative effort.
[0061] Figure 1A flowchart of a method for generating a neural network provided by an embodiment of this disclosure is shown;
[0062] Figure 2 This illustration shows a schematic diagram of a neural network structure based on a target search space provided in an embodiment of the present disclosure;
[0063] Figure 3 The diagram illustrates the network structure of different downsampling processing units provided in the embodiments of this disclosure.
[0064] Figure 4 This illustration shows a schematic diagram of the specific process of network structure search provided in an embodiment of this disclosure;
[0065] Figure 5 A schematic diagram of an apparatus for generating a neural network provided in an embodiment of the present disclosure is shown;
[0066] Figure 6 A schematic diagram of the structure of a computer device provided in an embodiment of this disclosure is shown. Detailed Implementation
[0067] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this disclosure, and not all of them. The components of the embodiments of this disclosure described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this disclosure provided in the accompanying drawings is not intended to limit the scope of the claimed disclosure, but merely represents selected embodiments of this disclosure. All other embodiments obtained by those skilled in the art based on the embodiments of this disclosure without inventive effort are within the scope of protection of this disclosure.
[0068] Furthermore, the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in a sequence other than that illustrated or described herein.
[0069] In this article, "multiple or several" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following related objects have an "or" relationship.
[0070] Research has found that neural networks built using human experience, after being trained, have performance limitations in terms of accuracy and resource consumption during deep learning tasks, which need improvement.
[0071] Based on the above research, this disclosure provides a method for generating neural networks. A search space is pre-constructed for searching neural network structures. Each search space contains multiple networks or multiple size information. Therefore, the multiple search spaces constructed in this method provide a large search space. A network structure corresponding to a preset network structure unit is searched in the first search space, a network structure corresponding to a downsampling processing unit is searched in the second search space, and the size information of the neural network structure is searched in the third search space. Searching for network structures within a large search space allows for the acquisition of various neural network structures, increasing the diversity of the obtained neural network structures and thus improving the processing performance of the final target neural network for deep learning tasks. Furthermore, based on the searched network structures and size information, a neural network structure is constructed. Combined with the training dataset corresponding to the preset deep learning task and the expected results of the deep learning task, a target neural network structure corresponding to the expected results of the deep learning task can be obtained, i.e., a target neural network with the expected accuracy can be obtained.
[0072] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.
[0073] The following is a detailed description of the specific terms used in the embodiments of this disclosure:
[0074] 1. A multilayer perceptron (MLP) is a feedforward artificial neural network model that maps multiple input datasets to a single output dataset.
[0075] 2. The Transformer is an encoder-decoder network structure based on the self-attention mechanism. It uses the self-attention mechanism instead of the sequential structure of the Recurrent Neural Network (RNN), which allows the model to be trained in parallel and to have global information.
[0076] 3. Convolutional Neural Networks (CNNs) are a type of multi-layer neural network specifically designed to process two-dimensional data. They can extract the topological structure of a two-dimensional image, use the backpropagation algorithm to optimize the network structure, and solve for unknown parameters in the network.
[0077] To facilitate understanding of this embodiment, a method for generating a neural network disclosed in this disclosure will first be described in detail. The execution subject of the method for generating a neural network provided in this disclosure is generally a computer device with a certain computing power. In some possible implementations, this method for generating a neural network can be implemented by a processor calling computer-readable instructions stored in memory.
[0078] The following describes the method for generating neural networks provided in this disclosure, taking a computer device as the execution subject as an example.
[0079] See Figure 1 The diagram shows a flowchart of a method for generating a neural network according to an embodiment of this disclosure. The method includes steps S101 to S103, wherein:
[0080] S101: Determine the first search space corresponding to the preset network structure unit, the second search space corresponding to the downsampling processing unit, and the third search space corresponding to the size information of the neural network structure. The preset network structure unit and the downsampling processing unit are used to construct the neural network structure.
[0081] In this step, the preset network structure unit may include the basic network structure unit used to construct the feature extraction unit in the complete neural network structure. The downsampling processing unit may include the network structure unit used to perform downsampling processing.
[0082] Here, the first, second, and third search spaces can be pre-constructed target search spaces for neural network structures. The first search space includes pre-defined network structures corresponding to pre-set network structure units, i.e., network structures used to perform mainstream operations in deep learning tasks, such as CNN, Transformer, and MLP networks. The second search space includes pre-defined network structures corresponding to pre-set downsampling processing units, i.e., network structures used to perform downsampling tasks in deep learning, such as local downsampling network structures, global-local downsampling network structures, and global downsampling network structures. The third search space stores pre-defined size information of the neural network structure, such as the number of network iterations (repeats), the number of network channels (channels), and the channel adjustment parameter (expansion).
[0083] The size information in the third search space can be used to configure the preset network structure units, which is the size information of the preset network structure units. The unified form of the size information in the third search space is used to configure the network structure corresponding to the preset network structure units, which facilitates the subsequent testing of the obtained neural network structure for deep learning tasks.
[0084] Preset network structure units and downsampling processing units are used to construct the neural network structure. Size information is used to configure the size data of the network structure corresponding to the preset network structure units.
[0085] For example, if multiple preset network structure units are found from the first search space, and each preset network structure unit corresponds to a CNN network structure, a Transformer network structure, and an MLP network structure, the network structure corresponding to each preset network structure unit can be configured using a unified format, namely repeats, channels, and expansion. For example, repeats-1, channels-1, and expansion-1 can be used to configure the CNN network structure; repeats-2, channels-2, and expansion-2 can be used to configure the Transformer network structure; and repeats-3, channels-3, and expansion-3 can be used to configure the MLP network structure. Here, repeats-1, repeats-2, and repeats-3 represent different data; channels-1, channels-2, and channels-3 represent different data; and expansion-1, expansion-2, and expansion-3 represent different data.
[0086] S102: Based on the first search space, the second search space, and the third search space, as well as the training dataset corresponding to the preset deep learning task, perform network structure search to obtain the target neural network structure corresponding to the expected result of the deep learning task.
[0087] In practice, the network structure corresponding to the preset network structure unit can be searched in the first search space; the network structure corresponding to the downsampling processing unit can be searched in the second search space; and the size information of the preset network structure unit can be searched in the third search space. Then, based on the searched network structure and size information, a complete neural network structure is constructed.
[0088] Here, multiple preset network structure units can be searched from the first search space to obtain multiple preset network structure units. The number of preset network structure units can be set according to empirical values or deep learning tasks in actual applications, and this embodiment does not impose a specific limitation. For multiple preset network structure units, in the process of processing deep learning tasks, the order in which each preset network structure unit performs tasks can be set according to the time order in which it is searched from the first search space; or, it can be set according to the preset position information of the preset network structure units. Here, there is a task execution order between the preset position information of different preset network structure units.
[0089] See Figure 2 The diagram illustrates a neural network structure constructed based on a target search space. The preset network structure unit 21 includes network structures searched from the first search space 23, such as Transformer network structure 211, CNN network structure 212, MLP network structure 213, CNN network structure 214, and Transformer network structure 215 (these network structures can be connected according to the searched time order, or the preset network structure units can be connected based on preset position information). The downsampling processing unit 22 includes network structures searched from the second search space 24, such as local downsampling network structure 221, global downsampling network structure 222, global-local downsampling network structure 223, and local downsampling network structure 224. Specifically, Transformer network structure 211 also includes size information repeats-1, channels-1, and expansion-1 searched from the third search network 25; CNN network structure 212 also includes size information repeats-2, channels-2, and expansion-2 searched from the third search network 25; MLP network structure 213 also includes size information repeats-3, channels-3, and expansion-3 searched from the third search network 25; CNN network structure 214 also includes size information repeats-4, channels-4, and expansion-4 searched from the third search network 25; and Transformer network structure 215 also includes size information repeats-5, channels-5, and expansion-5 searched from the third search network 25.
[0090] For example, for a CNN network structure, the repeats can be executed cyclically 10 times according to the repeats instruction, based on the original execution order; the number of convolution channels can be set according to channels; and the number of channels can be expanded or reduced according to the expansion instruction, thus changing the number of convolution channels in different convolutional layers.
[0091] After obtaining the neural network structure, parameters can be assigned to the neural network structure, and the test neural network corresponding to the neural network structure can be initially trained using the training dataset corresponding to the preset deep learning task. Then, the deep learning task can be processed based on the test neural network that has been initially trained, and the processing result of the deep learning task can be obtained.
[0092] Here, the training dataset can be used to test the initial training process of the neural network, or to test the neural network for deep learning tasks.
[0093] For example, this applies to a test neural network that has already undergone initial training; such as... Figure 2 The neural network 20 is tested as shown. First, the Transformer corresponding to the first preset network structure unit 21 processes the test data of the deep learning task. Then, it is executed sequentially. The local downsampling network corresponding to the first downsampling processing unit 22 further processes the output result of the Transformer; until the Transformer corresponding to the Transformer network structure 215 outputs the task processing result. It can be understood that, in addition to the preset network structure units and downsampling processing units mentioned above, the neural network may also include fully connected layers and / or classifiers, etc., to obtain the final processing result of the deep learning task, such as image classification result or object detection result.
[0094] Subsequently, if the desired result is achieved during the deep learning task processing, the constructed neural network structure can be used as the target neural network structure. Here, achieving the desired result can include the actual processing result of the neural network being consistent with the desired result, or the difference between the two satisfying preset conditions. The desired result can serve as the label information of the training data in the training dataset for the deep learning task.
[0095] In some embodiments, preset conditions of network structure search results can also be used as conditions for the expected results of deep learning tasks. For example, the first selection probability of a preset network structure unit is greater than or equal to a first preset threshold; and / or, the second selection probability of a downsampling processing unit is greater than or equal to a second preset threshold; and / or, the third selection probability of the size information corresponding to the preset network structure unit is greater than or equal to a third preset threshold; and / or, the accuracy of the processing result of the deep learning task is greater than or equal to a fourth preset threshold, and so on.
[0096] Here, the first preset threshold, the second preset threshold, the third preset threshold, and the fourth preset threshold can be set based on empirical values, and this embodiment does not impose specific limitations.
[0097] S103: Generate a target neural network for processing deep learning tasks based on the target neural network structure.
[0098] Once the target neural network structure is determined, parameters can be assigned to the target neural network structure, and after multiple iterations of training, a target neural network for processing deep learning tasks can be formed.
[0099] In practice, the training dataset corresponding to the preset deep learning task can be used to further train the test neural network corresponding to the target neural network structure that has already completed preliminary training in S102, thereby generating the target neural network for processing deep learning tasks and obtaining accurate task processing results.
[0100] In some embodiments, multiple training samples may be obtained; then, the target neural network corresponding to the target neural network structure is trained using the training samples until the training cutoff condition is met, and the trained target neural network is obtained.
[0101] Here, training samples can be a subset of training samples from the training dataset corresponding to the deep learning task, such as samples other than those used in the initial training of the target neural network structure. The target neural network to be trained can be a target neural network that has already completed initial training. The training cutoff condition can be that the accuracy of the target neural network's processing result is greater than a preset accuracy, or that the number of training iterations is greater than a set value, etc.
[0102] In steps S101 to S103 above, a search space for searching neural network structures is pre-constructed. Each search space contains multiple networks or various size information. Therefore, the multiple search spaces constructed in this aspect provide a larger search space. For example, a network structure corresponding to a preset network structure unit can be searched from the first search space, a network structure corresponding to a downsampling processing unit can be searched from the second search space, and the size information of the neural network structure can be searched from the third search space. Searching for network structures within a wider search space allows for the acquisition of various neural network structures, increasing the diversity of the searched neural network structures and thus improving the performance of the final target neural network in deep learning tasks. Furthermore, based on the searched network structures and size information, a neural network structure is constructed. Combined with the training dataset corresponding to the preset deep learning task and the expected results of the deep learning task, a target neural network structure corresponding to the expected results of the deep learning task can be obtained, i.e., a target neural network that satisfies the expected processing results of the deep learning task.
[0103] The first search space in S101 can include at least two of the following: convolutional structure units, self-attention-based encoder-decoder structure units, and multilayer perceptron (MLP) structure units. For example, a convolutional structure unit can include a CNN network structure; a self-attention-based encoder-decoder structure unit can include a Transformer network structure; and a multilayer perceptron (MLP) structure unit can include an MLP network structure.
[0104] The second search space in S101 can include a local downsampling unit, a global downsampling unit, and a global-local downsampling unit. The local downsampling unit is used to sample local context information, the global downsampling unit is used to sample global context information, and the global-local downsampling unit is used to sample both global and local context information.
[0105] For example, the local downsampling unit is used to sample local features of the input data, that is, to extract features based on the local information of the input data and obtain features related to the local information; the global downsampling unit is used to sample global features of the input data, that is, to sample features related to the global information based on the global information of the input data; the global-local downsampling unit is used to sample local features and global features of the input data and perform fusion processing to obtain global-local fused features, that is, to extract features based on the local information of the input data and obtain features related to the local information, and to sample features related to the global information based on the global information of the input data, and then to fuse the obtained features related to the local information and the features related to the global information to obtain global-local fused features.
[0106] See also Figure 3 The diagram illustrates the network structures of different downsampling processing units, including a local downsampling network structure 31, a global downsampling network structure 32, and a global-local downsampling network structure 33. The local downsampling network structure 31 may include a first convolution operator 311 for performing convolution operations. The first convolution operator 311 may include a two-dimensional convolutional network structure, such as Conv2d, with a stride of 2, denoted as s2. The global downsampling network structure 32 may include a first processing unit 321 based on a self-attention mechanism, such as Multi-Head Attention, and a second convolution operator 322 for performing convolution operations on the data input to the first processing unit. The second convolution operator 322 may include a one-dimensional convolutional network structure, such as Conv1d, with a stride of 2. Here, the data input to the first processing unit may include the input data to the global downsampling network structure 32, that is, the output data of the previous network structure unit in a constructed neural network structure. The first processing unit 321 and the second convolution operator 322 can process the same input data. The first processing unit 321 can also process the output data of the second convolution operator 322 and fuse the two processing results to obtain the output data.
[0107] The global-local downsampling network structure 33 may include a second processing unit 331 based on a self-attention mechanism, such as Multi-Head Attention, and a third convolution operator 332 for performing convolution operations on the data input to the second processing unit. The third convolution operator 332 may include a two-dimensional convolutional network structure, such as Conv2d, with a stride of 2. Here, the data input to the second processing unit can be the input data to the global-local downsampling network structure 33, that is, the output data of the previous network structure unit in a certain constructed neural network structure. The second processing unit 331 and the third convolution operator 332 can process the same input data. The second processing unit 331 can also process the output data of the third convolution operator 332, and fuse the two processing results to obtain the output data.
[0108] For example, for a local downsampling network structure, i.e., Conv2d, a convolution operation with a stride of 2 and a kernel size of 3×3 can be used. For a global downsampling network structure, firstly, Conv1d can be used to perform a convolution operation on the input data, for example, a convolution operation with a stride of 2, to sample the query data, denoted as Q. Then, using different weight information, the input data is linearly transformed to obtain the key data, denoted as K, and the valuable data, denoted as V. Then, Multi-Head Attention is used to fuse the query data, key data, and valuable data, for example, by weighted fusion of the corresponding data, to obtain the output data of the global downsampling network structure. For a global-local downsampling network structure, the sampling process of the global downsampling network structure described above can be referred to, and the repeated parts will not be repeated.
[0109] For network structure search of S102, please refer to [link / reference]. Figure 4 The diagram shown illustrates the specific process of network structure search, including steps S401 to S405, where:
[0110] S401: Construct the target search space based on the first search space, the second search space, and the third search space.
[0111] Here, the target search space may include multiple sub-search spaces, namely the first search space, the second search space, and the third search space, etc., which can be found in [reference]. Figure 2 As shown.
[0112] S402: Determine multiple candidate neural network structures based on the target search space.
[0113] Here, the structural diagram of the candidate neural network structure can be seen in Figure 2. Each candidate neural network structure may include at least one preset network structure unit selected from the first search space and at least one downsampling processing unit selected from the second search space. The size information of each preset network structure unit in each candidate neural network is the size information selected from the third search space.
[0114] Candidate neural network structures are used to construct candidate neural networks to perform deep learning tasks.
[0115] S403: Construct the corresponding candidate neural network based on the candidate neural network structure.
[0116] Specifically, network parameters can be assigned to the candidate neural network structure to construct the corresponding candidate neural network.
[0117] S404: Use the training dataset corresponding to the preset deep learning task to determine the processing result of the candidate neural network for the deep learning task.
[0118] Data from the training dataset corresponding to a pre-defined deep learning task can be used as training data to initially train a candidate neural network. The pre-trained candidate neural network can then be used to process the deep learning task to obtain the processing result of the deep learning task.
[0119] S405: With the goal of minimizing the difference between the processing result of the candidate neural network on the deep learning task and the expected result, the target neural network structure is searched in the target search space based on the candidate neural network structure.
[0120] The processing results of deep learning tasks can include the task results of deep learning tasks output by candidate neural networks, such as the classification results of image classification tasks. Alternatively, they can be the results of updating the first selection probability of preset network structure units, updating the second selection probability of downsampling processing units, and updating the third selection probability of the size information corresponding to the preset network structure units.
[0121] The expected result of a deep learning task can be a pre-set maximum accuracy threshold for the processing result of the deep learning task; or, it can be that the first selection probability of a preset network structure unit in the current candidate neural network structure is greater than or equal to a first preset threshold; and / or, the second selection probability of a downsampling processing unit is greater than or equal to a second preset threshold; and / or, the third selection probability of the size information corresponding to the preset network structure unit is greater than or equal to a third preset threshold, and so on.
[0122] When the expected result is the maximum accuracy threshold, difference minimization can be achieved when the difference between the accuracy of the processing result and the maximum accuracy threshold is less than or equal to a preset minimum difference threshold; when the expected result is a first selection probability greater than or equal to a first preset threshold, difference minimization can be achieved when the first selection probability of any preset network structure unit in the current candidate neural network structure is greater than or equal to a first preset threshold; when the expected result is a second selection probability greater than or equal to a second preset threshold, difference minimization can be achieved when the second selection probability of any downsampling processing unit in the current candidate neural network structure is greater than or equal to a second preset threshold; when the expected result is a third selection probability greater than or equal to a third preset threshold, difference minimization can be achieved when the third selection probability of the size information corresponding to any preset network structure unit in the current candidate neural network structure is greater than or equal to a third preset threshold.
[0123] For each candidate neural network structure among multiple candidate neural network structures, the target neural network structure can be searched in the target search space based on the candidate neural network structure with the objective of minimizing the difference between the processing result of the candidate neural network on the deep learning task and the expected result.
[0124] Taking image classification as an example, the expected result of the image classification task can be the maximum accuracy of the image classification result, such as 100%. The minimum difference value can be set to 0, 5%, or 10%, etc., and the specific data can be set according to empirical values. This disclosure does not impose specific limitations. When the difference between the accuracy of the candidate neural network processing result and the maximum accuracy is less than or equal to the minimum difference value, the candidate neural network structure can be used as the target neural network structure for processing this image classification task. When the difference between the accuracy of the candidate neural network processing result and the maximum accuracy is greater than the minimum difference value, a feedback value can be calculated based on this difference. Guided by the feedback value, a candidate neural network structure is re-searched in the target search space based on a genetic algorithm or reinforcement learning method. The above network structure search process is repeated until the difference between the accuracy of the candidate neural network processing result and the maximum accuracy is less than or equal to the minimum difference value.
[0125] Optionally, if the difference between the accuracy of the candidate neural network processing result and the maximum accuracy is greater than the minimum difference value, based on the image classification result corresponding to each candidate neural network structure among multiple candidate neural network structures, the candidate neural network structure corresponding to the image classification result with the highest accuracy is determined, and the probability of each preset network structure unit, downsampling processing unit, and size information corresponding to each preset network structure unit being selected in the next network search is updated. Based on the updated probability, the above network search steps are repeated, that is, the next network search is performed, and so on until the target neural network structure is found.
[0126] In some embodiments, a subset of candidate neural network structures can be selected from multiple candidate neural network structures, and the network structure can be searched in groups to determine the target neural network structure. Specifically, based on the processing results of each target candidate neural network structure in the subset of candidate neural network structures for the deep learning task, the first selection probability of each preset network structure unit, the second selection probability of each downsampling processing unit, and the third selection probability of the size information corresponding to each preset network structure unit can be updated respectively. Based on the updated first, second, and third selection probabilities, network structure search can be performed, and multiple new target candidate neural network structures can be reselected using genetic algorithms, reinforcement learning algorithms, etc. If the differences between the processing results of the multiple new target candidate neural network structures for the deep learning task and the expected results do not meet the first preset condition, the process returns to updating the selection probabilities.
[0127] For example, the processing results with the highest accuracy can be selected from the processing results of deep learning tasks corresponding to some candidate neural network structures. It is then determined whether the difference between the processing result with the highest accuracy and the maximum accuracy threshold indicated by the expected result is less than or equal to a preset minimum difference threshold. If not, the candidate neural network structure corresponding to the processing result is determined, and further, the first selection probability of each preset network structure unit, the second selection probability of each downsampling processing unit, and the third selection probability of the size information corresponding to each preset network structure unit are determined. If none of the first, second, or third selection probabilities meet the expected result, the first selection probability of each preset network structure unit, the second selection probability of each downsampling processing unit, and the third selection probability of the size information corresponding to each preset network structure unit are updated respectively. For example, the first selection probability of each preset network structure unit, the second selection probability of each downsampling processing unit, and the third selection probability of the size information corresponding to each preset network structure unit can be increased. Here, the increase can be set according to the actual situation and empirical values, and this embodiment does not impose specific limitations. Based on the updated first selection probability, second selection probability, and third selection probability, the network structure search is performed again from the target search space, that is, the network search in S102 is repeated, and multiple new target candidate neural network structures can be selected again.
[0128] Subsequently, if the differences between the processing results of multiple new target candidate neural network structures for the deep learning task and the expected results do not meet the first preset condition, the process returns to the step of updating the selection probability. For example, if the expected result is the maximum accuracy threshold, and the difference between the accuracy of the deep learning task processing result and the maximum accuracy threshold is greater than a preset minimum difference threshold, the process returns to the step of updating the selection probability. And / or, if the expected result is a first selection probability greater than or equal to the first preset threshold, and the first selection probability of the updated preset network structure unit is less than the first preset threshold, the process returns to the step of updating the selection probability. And / or, if the expected result is a second selection probability greater than or equal to the second preset threshold, and the updated second selection probability is less than the second preset threshold, the process returns to the step of updating the selection probability. And / or, if the expected result is a third selection probability greater than or equal to the third preset threshold, and the updated third selection probability is less than the third preset threshold, the process returns to the step of updating the selection probability.
[0129] In some embodiments, if the differences between the processing results and the expected results of the deep learning task by the multiple new target candidate neural network structures satisfy a first preset condition, the new target candidate neural network structure corresponding to the differences that satisfy the first preset condition is taken as the target neural network structure.
[0130] Continuing the previous example, if the difference between the accuracy of the deep learning task processing result and the maximum accuracy threshold is less than or equal to a preset minimum difference threshold, or if the first selection probability of any preset network structure unit in the new target candidate neural network structure is greater than or equal to a first preset threshold, or if the second selection probability of any downsampling processing unit in the new target candidate neural network structure is greater than or equal to a second preset threshold, or if the third selection probability of the size information corresponding to any preset network structure unit in the new target candidate neural network structure is greater than or equal to a third preset threshold, then the new target candidate neural network structure shall be used as the target neural network structure.
[0131] In some embodiments, based on the processing results of each target candidate neural network structure in the partial candidate neural network structure for the deep learning task, a target candidate neural network structure whose accuracy meets the second preset condition is determined; based on the target candidate neural network structure whose accuracy meets the second preset condition, the first selection probability of each preset network structure unit, the second selection probability of each downsampling processing unit, and the third selection probability of the size information corresponding to each preset network structure unit are updated respectively.
[0132] For example, from the processing results of deep learning tasks corresponding to some candidate neural network structures, some processing results with higher accuracy can be selected. For example, the accuracy of the processing results can be sorted, and the top two processing results with higher accuracy can be selected. The target candidate neural network structure corresponding to the selected processing result can be determined. Based on the first selection probability of each preset network structure unit, the second selection probability of each downsampling processing unit, and the third selection probability of the size information corresponding to each preset network structure unit in the original target candidate neural network structure, the first selection probability of each preset network structure unit, the second selection probability of each downsampling processing unit, and the third selection probability of the size information corresponding to each preset network structure unit can be updated respectively to prepare for the next network search.
[0133] In some embodiments, the candidate neural network structure may include a plurality of feature extraction nodes and a plurality of downsampling nodes spaced apart. The feature extraction nodes may include preset network structure units selected from a first search space, such as... Figure 2 The general operator (GOP) in the search space; downsampling nodes include downsampling processing units selected from the second search space, such as... Figure 2 The downsampling module (DSM) shown is used; the size information of each preset network structure unit is selected from the third search space.
[0134] Here, the number of intervals in the interval distribution can be limited according to the actual application process, and this disclosure does not impose a specific limitation.
[0135] Alternatively, the candidate neural network may include multiple feature extraction nodes that perform feature extraction tasks in succession, and multiple downsampling nodes that perform downsampling tasks in succession.
[0136] Those skilled in the art will understand that, in the above-described method of the specific implementation, the order in which each step is written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of each step should be determined by its function and possible internal logic.
[0137] Based on the same inventive concept, this disclosure also provides an apparatus for generating a neural network corresponding to the method for generating a neural network. Since the principle of the apparatus in this disclosure for solving the problem is similar to the method for generating a neural network described above, the implementation of the apparatus can refer to the implementation of the method, and repeated details will not be described again.
[0138] Reference Figure 5The diagram shown is a schematic of an apparatus for generating a neural network according to an embodiment of this disclosure. The apparatus includes: a search space determination module 501, a network structure search module 502, and a neural network generation module 503; wherein,
[0139] Search space determination module 501 is used to determine the first search space corresponding to the preset network structure unit, the second search space corresponding to the downsampling processing unit, and the third search space corresponding to the size information of the neural network structure. The preset network structure unit and the downsampling processing unit are used to construct the neural network structure.
[0140] The network structure search module 502 is used to perform network structure search based on the first search space, the second search space and the third search space, as well as the training dataset corresponding to the preset deep learning task, to obtain the target neural network structure corresponding to the expected result of the deep learning task.
[0141] The neural network generation module 503 is used to generate a target neural network for processing deep learning tasks based on the target neural network structure.
[0142] In one optional implementation, the first search space includes at least two of the following: convolutional structural units, self-attention-based encoder-decoder structural units, and multilayer perceptron (MLP) structural units.
[0143] In one optional implementation, the second search space includes a local downsampling unit, a global downsampling unit, and a global-local downsampling unit, wherein the local downsampling unit is used to sample local context information, the global downsampling unit is used to sample global context information, and the global-local downsampling unit is used to sample both global and local context information.
[0144] In one optional implementation, the local downsampling unit includes a first convolution operator for performing convolution operations;
[0145] The global downsampling unit includes a first processing unit based on a self-attention mechanism and a second convolution operator for performing convolution operations on the data input to the first processing unit.
[0146] The global-local downsampling unit includes a second processing unit based on a self-attention mechanism and a third convolution operator for performing convolution operations on the data input to the second processing unit.
[0147] In one optional implementation, the network structure search module 502 is used to construct a target search space based on the first search space, the second search space, and the third search space;
[0148] Multiple candidate neural network structures are determined based on the target search space; wherein each candidate neural network structure includes at least one preset network structure unit selected from the first search space and at least one downsampling processing unit selected from the second search space, and the size information of each preset network structure unit in each candidate neural network is the size information selected from the third search space;
[0149] Construct a corresponding candidate neural network based on the aforementioned candidate neural network structure;
[0150] The processing result of the candidate neural network for the deep learning task is determined using the training dataset corresponding to the preset deep learning task.
[0151] With the goal of minimizing the difference between the processing result of the candidate neural network on the deep learning task and the expected result, a target neural network structure is searched in the target search space based on the candidate neural network structure.
[0152] In one optional implementation, the network structure search module 502 is used to update the first selection probability of each preset network structure unit, the second selection probability of each downsampling processing unit, and the third selection probability of the size information corresponding to each preset network structure unit based on the processing result of each target candidate neural network structure in the partial candidate neural network structure for the deep learning task.
[0153] Based on the updated first selection probability, second selection probability and third selection probability, network structure search is performed to reselect multiple new target candidate neural network structures;
[0154] If the differences between the processing results of the multiple new target candidate neural network structures for the deep learning task and the expected results do not meet the first preset condition, the process returns to the step of updating the selection probability.
[0155] In one optional implementation, the network structure search module 502 is used to determine the target candidate neural network structure whose accuracy satisfies a second preset condition based on the processing result of each target candidate neural network structure in the partial candidate neural network structure for the deep learning task.
[0156] Based on the target candidate neural network structure whose accuracy meets the second preset condition corresponding to the processing result, the first selection probability of each preset network structure unit, the second selection probability of each downsampling processing unit, and the third selection probability of the size information corresponding to each preset network structure unit are updated respectively.
[0157] In an optional implementation, the network structure search module 502 is further configured to, when the differences between the processing results of the deep learning task by the plurality of new target candidate neural network structures and the expected results satisfy the first preset condition, select the new target candidate neural network structure corresponding to the differences that satisfy the first preset condition as the target neural network structure.
[0158] In one optional implementation, the candidate neural network structure includes multiple feature extraction nodes and multiple downsampling nodes spaced apart; wherein the feature extraction nodes include preset network structure units selected from a first search space; the downsampling nodes include downsampling processing units selected from a second search space; and the size information of each preset network structure unit is selected from a third search space.
[0159] In one optional implementation, the neural network generation module 503 is used to acquire multiple training samples;
[0160] The target neural network corresponding to the target neural network structure is trained using the training samples until the training cutoff condition is met, thus obtaining the trained target neural network.
[0161] The processing flow of each module in the apparatus for generating neural networks, as well as the interaction flow between each module, can be described in the relevant descriptions in the above-described method embodiments for generating neural networks, and will not be elaborated here.
[0162] Based on the same technical concept, embodiments of this application also provide a computer device. (Refer to...) Figure 6 The diagram shown is a structural schematic of a computer device provided in an embodiment of this application, including:
[0163] The system includes a processor 61, a memory 62, and a bus 63. The memory 62 stores machine-readable instructions executable by the processor 61. The processor 61 executes these machine-readable instructions, and when executed, it performs the following steps: S101: Determine a first search space corresponding to a preset network structure unit, a second search space corresponding to a downsampling processing unit, and a third search space corresponding to the size information of the neural network structure. The preset network structure unit and the downsampling processing unit are used to construct the neural network structure; S102: Based on the first, second, and third search spaces, and the training dataset corresponding to the preset deep learning task, perform a network structure search to obtain a target neural network structure corresponding to the expected result of the deep learning task; S103: Generate a target neural network for processing the deep learning task based on the target neural network structure.
[0164] The aforementioned memory 62 includes a main memory 621 and an external memory 622. The main memory 621, also known as internal memory, is used to temporarily store the computational data in the processor 61, as well as the data exchanged with external memory such as a hard disk. The processor 61 exchanges data with the external memory 622 through the main memory 621. When the computer device is running, the processor 61 and the memory 62 communicate through the bus 63, so that the processor 61 executes the execution instructions mentioned in the above method embodiments.
[0165] This disclosure also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the steps of the method for generating a neural network described in the above-described method embodiments. The storage medium may be a volatile or non-volatile computer-readable storage medium.
[0166] This disclosure also provides a computer program product, including computer instructions, which, when executed by a processor, implement the steps of the above-described method for generating a neural network. The computer program product can be any product capable of implementing the above-described method for generating a neural network. Part or all of the solutions in the computer program product that contribute to the prior art can be embodied in the form of a software product (e.g., a software development kit, SDK). This software product can be stored in a storage medium, and the included computer instructions cause a relevant device or processor to execute part or all of the steps of the above-described method for generating a neural network.
[0167] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the device described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here. In the several embodiments provided in this disclosure, it should be understood that the disclosed device and method can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of modules is only a logical functional division; in actual implementation, there may be other division methods. Furthermore, multiple modules or components can be combined, or some features can be ignored or not executed. Another point is that the displayed or discussed mutual coupling or direct coupling or communication connection can be through some communication interfaces; the indirect coupling or communication connection of devices or modules can be electrical, mechanical, or other forms.
[0168] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0169] In addition, the functional modules in the various embodiments of this disclosure can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module.
[0170] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a processor-executable, non-volatile, computer-readable storage medium. Based on this understanding, the technical solution of this disclosure, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this disclosure. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0171] Finally, it should be noted that the above-described embodiments are merely specific implementations of this disclosure, used to illustrate the technical solutions of this disclosure, and not to limit it. The protection scope of this disclosure is not limited thereto. Although this disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this disclosure. Such modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this disclosure, and should all be covered within the protection scope of this disclosure. Therefore, the protection scope of this disclosure should be determined by the protection scope of the claims.
Claims
1. A method for generating a neural network, comprising: A first search space corresponding to a preset network structure unit, a second search space corresponding to a downsampling processing unit, and a third search space corresponding to the size information of the neural network structure are determined. The preset network structure unit and the downsampling processing unit are used to construct the neural network structure. Based on the first search space, the second search space, and the third search space, as well as the training dataset corresponding to the preset deep learning task, a network structure search is performed to obtain the target neural network structure corresponding to the expected result of the deep learning task. Based on the target neural network structure, a target neural network for processing deep learning tasks is generated; The target neural network is used to process image classification tasks, image detection tasks, or image segmentation tasks. The process of searching for network structures based on the first search space, the second search space, and the third search space, as well as the training dataset corresponding to the preset deep learning task, includes: Construct a target search space based on the first search space, the second search space, and the third search space; Multiple candidate neural network structures are determined based on the target search space; wherein each candidate neural network structure includes at least one preset network structure unit selected from the first search space and at least one downsampling processing unit selected from the second search space, and the size information of each preset network structure unit in each candidate neural network is the size information selected from the third search space; Construct a corresponding candidate neural network based on the aforementioned candidate neural network structure; The processing result of the candidate neural network for the deep learning task is determined using the training dataset corresponding to the preset deep learning task. With the goal of minimizing the difference between the processing result of the candidate neural network on the deep learning task and the expected result, a target neural network structure is searched in the target search space based on the candidate neural network structure.
2. The method according to claim 1, wherein, The first search space includes at least two of the following: convolutional structure units, encoder-decoder structure units based on self-attention mechanisms, and multilayer perceptron (MLP) structure units.
3. The method according to claim 1 or 2, wherein, The second search space includes a local downsampling unit, a global downsampling unit, and a global-local downsampling unit, wherein the local downsampling unit is used to sample local context information, the global downsampling unit is used to sample global context information, and the global-local downsampling unit is used to sample both global and local context information.
4. The method according to claim 3, wherein, The local downsampling unit includes a first convolution operator for performing convolution operations; The global downsampling unit includes a first processing unit based on a self-attention mechanism and a second convolution operator for performing convolution operations on the data input to the first processing unit. The global-local downsampling unit includes a second processing unit based on a self-attention mechanism and a third convolution operator for performing convolution operations on the data input to the second processing unit.
5. The method according to claim 1, wherein, The step of searching for the target neural network structure within the target search space based on the candidate neural network structure includes: Based on the processing results of each target candidate neural network structure in the partial candidate neural network structure for the deep learning task, the first selection probability of each preset network structure unit, the second selection probability of each downsampling processing unit, and the third selection probability of the size information corresponding to each preset network structure unit are updated respectively. Based on the updated first selection probability, second selection probability and third selection probability, network structure search is performed to reselect multiple new target candidate neural network structures; If the differences between the processing results of the multiple new target candidate neural network structures for the deep learning task and the expected results do not meet the first preset condition, the process returns to the step of updating the selection probability.
6. The method according to claim 5, wherein, The processing result of each target candidate neural network structure in the partial candidate neural network structure for the deep learning task, based on the processing result of each target candidate neural network structure, updates the first selection probability of each preset network structure unit, the second selection probability of each downsampling processing unit, and the third selection probability of the size information corresponding to each preset network structure unit, including: Based on the processing results of each target candidate neural network structure in the partial candidate neural network structure for the deep learning task, the target candidate neural network structure whose accuracy meets the second preset condition is determined. Based on the target candidate neural network structure whose accuracy meets the second preset condition corresponding to the processing result, the first selection probability of each preset network structure unit, the second selection probability of each downsampling processing unit, and the third selection probability of the size information corresponding to each preset network structure unit are updated respectively.
7. The method according to claim 5 or 6, wherein, The step of searching for the target neural network structure within the target search space based on the candidate neural network structure further includes: If the differences between the processing results of the multiple new target candidate neural network structures on the deep learning task and the expected results satisfy the first preset condition, the new target candidate neural network structure corresponding to the differences that satisfy the first preset condition shall be taken as the target neural network structure.
8. The method according to any one of claims 1-2 and 4-6, wherein, The candidate neural network structure includes multiple feature extraction nodes and multiple downsampling nodes spaced apart; wherein, the feature extraction nodes include preset network structure units selected from a first search space; the downsampling nodes include downsampling processing units selected from a second search space; wherein, the size information of each preset network structure unit is selected from the third search space.
9. The method according to any one of claims 1-2 and 4-6, wherein, The generation of the target neural network for processing deep learning tasks based on the target neural network structure includes: Obtain multiple training samples; The target neural network corresponding to the target neural network structure is trained using the training samples until the training cutoff condition is met, thus obtaining the trained target neural network.
10. An apparatus for generating a neural network, comprising: The search space determination module is used to determine the first search space corresponding to the preset network structure unit, the second search space corresponding to the downsampling processing unit, and the third search space corresponding to the size information of the neural network structure. The preset network structure unit and the downsampling processing unit are used to construct the neural network structure. The network structure search module is used to perform network structure search based on the first search space, the second search space, and the third search space, as well as the training dataset corresponding to the preset deep learning task, to obtain the target neural network structure corresponding to the expected result of the deep learning task. A neural network generation module is used to generate a target neural network for processing deep learning tasks based on the target neural network structure. The target neural network is used to process image classification tasks, image detection tasks, or image segmentation tasks. The network structure search module is specifically used to: construct a target search space based on the first search space, the second search space, and the third search space; Multiple candidate neural network structures are determined based on the target search space; wherein each candidate neural network structure includes at least one preset network structure unit selected from the first search space and at least one downsampling processing unit selected from the second search space, and the size information of each preset network structure unit in each candidate neural network is the size information selected from the third search space; Construct a corresponding candidate neural network based on the aforementioned candidate neural network structure; The processing result of the candidate neural network for the deep learning task is determined using the training dataset corresponding to the preset deep learning task. With the goal of minimizing the difference between the processing result of the candidate neural network on the deep learning task and the expected result, a target neural network structure is searched in the target search space based on the candidate neural network structure.
11. A computer device, characterized in that, include: The computer device includes a processor, a memory, and a bus, wherein the memory stores machine-readable instructions executable by the processor, and the processor communicates with the memory via the bus when the computer device is running, and the machine-readable instructions, when executed by the processor, perform the steps of the method for generating a neural network as described in any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, performs the steps of the method for generating a neural network as described in any one of claims 1 to 9.
Citation Information
Patent Citations
Neural network construction method and device
CN111797983A
Neural network architecture searching method and device and electronic equipment
CN112766466A