Neural network structure determination method and device and related products
By performing multi-cycle hyperparameter tuning and neural network structure search, the neural network structure is optimized, which solves the problem of inaccurate structure caused by preset hyperparameters and improves the training accuracy and structural accuracy of the neural network.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CAMBRICON SINGGO (NANJING) TECH CO LTD
- Filing Date
- 2021-05-11
- Publication Date
- 2026-07-31
AI Technical Summary
During neural network training, setting hyperparameters may lead to inaccurate final network structure, affecting accuracy.
The neural network structure is optimized through multiple hyperparameter adjustment cycles. Hyperparameters with good training effects are selected and those with poor effects are removed. The network structure is gradually optimized, and the optimal neural network is determined iteratively by combining hyperparameter optimization and neural network structure search.
This improves the training accuracy and structural accuracy of neural networks, ensuring higher precision in the selected hyperparameters and a more suitable network structure.
Smart Images

Figure CN115329924B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and in particular to a method and apparatus for determining neural network structures, as well as related products. Background Technology
[0002] Both network structure and training hyperparameters affect the accuracy of neural networks. During training, a set of hyperparameters is typically preset, and network weight training and network structure search are performed alternately under this set of hyperparameters to obtain an optimal structure. However, different training hyperparameters will result in neural networks with varying degrees of accuracy. Therefore, pre-setting a single set of hyperparameters may lead to an inaccurate final network structure. Summary of the Invention
[0003] This disclosure presents a method, apparatus, electronic device, and storage medium for determining neural network structures.
[0004] According to one aspect of this disclosure, a method for determining a neural network structure is provided, comprising: training a first sub-network of a current first neural network based on hyperparameters of a first hyperparameter tuning cycle to obtain a second neural network for the first hyperparameter tuning cycle, wherein the first neural network includes multiple network layers, each network layer includes multiple network blocks, the first sub-network includes network blocks randomly selected from the multiple network blocks of each network layer of the first neural network, and the hyperparameters of the first hyperparameter tuning cycle are selected from a current hyperparameter set; performing hyperparameter tuning processing based on a first set and a second set of current hyperparameter tuning cycles to determine the hyperparameters of the next hyperparameter tuning cycle from the current hyperparameter set. The system calculates parameters and determines the second neural network for the next hyperparameter tuning cycle. The first set of the current hyperparameter tuning cycle includes the hyperparameters of the current hyperparameter tuning cycle and the hyperparameters of the historical hyperparameter tuning cycles. The second set of the current hyperparameter tuning cycle includes the verification results of the second neural network of the current hyperparameter tuning cycle and the verification results of the second neural network of the historical hyperparameter tuning cycles. Based on the first set and second set of the last hyperparameter tuning cycle, and the second neural networks of multiple hyperparameter tuning cycles, the system determines the third neural network and the optimized hyperparameter set, wherein the number of hyperparameters in the optimized hyperparameter set is less than the number of hyperparameters in the current hyperparameter set. Based on the third neural network and the optimized hyperparameter set, the system obtains the target neural network.
[0005] In one possible implementation, the method further includes: randomly sampling network blocks at each network layer of the second neural network to determine first network blocks from each network layer; determining second sub-networks based on the first network blocks at each network layer; processing training samples with labeled information through the second sub-network to determine a first processing result of the second sub-network; determining the accuracy of the second sub-network based on the first processing result and the labeled information; and determining the verification result of the second neural network based on the accuracy of multiple second sub-networks.
[0006] In one possible implementation, the verification results include the average accuracy of multiple second sub-networks.
[0007] In one possible implementation, determining the third neural network and the optimized hyperparameter set based on the first set and second set of the last hyperparameter tuning cycle, and the second neural network of multiple hyperparameter tuning cycles, includes: determining the target hyperparameter in the first set of the last hyperparameter tuning cycle based on the second set of the last hyperparameter tuning cycle; determining the second neural network of the hyperparameter tuning cycle corresponding to the target hyperparameter as the third neural network; and reducing the hyperparameter set of the current structure tuning cycle based on the second set of the last hyperparameter tuning cycle or the target hyperparameter to obtain the optimized hyperparameter set.
[0008] In one possible implementation, the hyperparameter set of the current structure adjustment cycle is reduced according to the second set of the last hyperparameter adjustment cycle or the target hyperparameter to obtain the optimized hyperparameter set, including: when the hyperparameters are continuous variables, retaining the hyperparameters within a preset neighborhood centered on the target hyperparameter and removing the hyperparameters outside the preset neighborhood.
[0009] In one possible implementation, the hyperparameter set of the current structure adjustment cycle is reduced according to the second set of the last hyperparameter adjustment cycle or the target hyperparameter to obtain the optimized hyperparameter set, including: removing the first hyperparameter when the hyperparameter is a discrete variable, wherein the verification result of the second neural network corresponding to the first hyperparameter does not meet the accuracy condition.
[0010] In one possible implementation, the structural adjustment cycle includes multiple hyperparameter adjustment cycles. The current hyperparameter set is the hyperparameter set of the current structural adjustment cycle, and the optimized hyperparameter set is the hyperparameter set of the next hyperparameter adjustment cycle. The current first neural network is the first neural network of the current structural adjustment cycle. Obtaining the target neural network based on the third neural network and the optimized hyperparameter set includes: determining the first neural network of the next structural adjustment cycle based on the verification results of the third neural network, wherein the number of network blocks in each layer of the first neural network of the next structural adjustment cycle is less than the number of network blocks in each layer of the first neural network of the current structural adjustment cycle; and obtaining the target neural network based on the network of the first neural network of the next structural adjustment cycle and the hyperparameter set of the next structural adjustment cycle, wherein the target neural network is a first neural network whose structure meets the structural conditions.
[0011] In one possible implementation, the verification result of the third neural network includes the verification results of multiple third sub-networks. Each third sub-network comprises randomly selected network blocks from multiple network blocks at each network level of the third neural network. Determining the first neural network for the next structural adjustment cycle based on the verification results of the third neural network includes: identifying fourth sub-networks that do not meet a preset accuracy requirement from among the multiple third sub-networks based on their verification results; statistically analyzing the network blocks at each network level of the preset number of fourth sub-networks to determine second network blocks at each network level within the preset number of fourth sub-networks, wherein the second network block is a network block that meets the quantity requirement among the network blocks at each network level of the preset number of fourth sub-networks; and removing the second network block from the third neural network to obtain the first neural network for the next structural adjustment cycle.
[0012] In one possible implementation, the plurality of third sub-networks include a sub-network obtained by randomly sampling multiple network blocks of each network layer of the second neural network corresponding to the third neural network when determining the verification result in the second set, and a sub-network obtained by randomly sampling multiple network blocks of each network layer of the third neural network after determining the third neural network.
[0013] In one possible implementation, the method further includes: training the target neural network using hyperparameters randomly selected from the set of hyperparameters of the structural adjustment period corresponding to the target neural network, and training samples with labeled information, to obtain the trained target neural network.
[0014] In one possible implementation, the target neural network is used to perform any one of text recognition tasks, audio processing tasks, image processing tasks, and video processing tasks.
[0015] According to another aspect of this disclosure, a neural network structure determination apparatus is provided, the apparatus comprising: a first training module, configured to train a first sub-network of a current first neural network based on hyperparameters of a first hyperparameter adjustment cycle to obtain a second neural network of the first hyperparameter adjustment cycle, wherein the first neural network includes multiple network layers, each network layer includes multiple network blocks, the first sub-network includes network blocks randomly selected from the multiple network blocks of each network layer of the first neural network, and the hyperparameters of the first hyperparameter adjustment cycle are selected from a current hyperparameter set; and a hyperparameter adjustment module, configured to perform hyperparameter adjustment processing based on a first set and a second set of current hyperparameter adjustment cycles to determine the next hyperparameter adjustment cycle from the current hyperparameter set. The system calculates hyperparameters for the current hyperparameter tuning period and determines the second neural network for the next hyperparameter tuning period. The first set of the current hyperparameter tuning periods includes the hyperparameters of the current hyperparameter tuning period and the hyperparameters of the historical hyperparameter tuning periods. The second set of the current hyperparameter tuning periods includes the verification results of the second neural network of the current hyperparameter tuning period and the verification results of the second neural network of the historical hyperparameter tuning periods. A first optimization module is used to determine a third neural network and an optimized hyperparameter set based on the first set and the second set of the last hyperparameter tuning period, as well as the second neural networks of multiple hyperparameter tuning periods. The number of hyperparameters in the optimized hyperparameter set is less than the number of hyperparameters in the current hyperparameter set. A first obtaining module is used to obtain a target neural network based on the third neural network and the optimized hyperparameter set.
[0016] In one possible implementation, the apparatus further includes a verification result determination module, configured to: randomly sample network blocks at each network layer of the second neural network to determine a first network block from each network layer; determine a second sub-network based on the first network blocks at each network layer; process training samples with labeled information through the second sub-network to determine a first processing result of the second sub-network; determine the accuracy of the second sub-network based on the first processing result and the labeled information; and determine the verification result of the second neural network based on the accuracy of multiple second sub-networks.
[0017] In one possible implementation, the verification results include the average accuracy of multiple second sub-networks.
[0018] In one possible implementation, the first optimization module is further configured to: determine a target hyperparameter in a first set of the last hyperparameter adjustment cycle based on a second set of the last hyperparameter adjustment cycle; determine the second neural network of the hyperparameter adjustment cycle corresponding to the target hyperparameter as the third neural network; and reduce the hyperparameter set of the current structure adjustment cycle based on the second set of the last hyperparameter adjustment cycle or the target hyperparameter to obtain the optimized hyperparameter set.
[0019] In one possible implementation, the first optimization module is further configured to: retain hyperparameters within a preset neighborhood centered on the target hyperparameter when the hyperparameters are continuous variables, and remove hyperparameters outside the preset neighborhood.
[0020] In one possible implementation, the first optimization module is further configured to: remove the first hyperparameter when the hyperparameter is a discrete variable, wherein the verification result of the second neural network corresponding to the first hyperparameter does not meet the accuracy condition.
[0021] In one possible implementation, the structural adjustment cycle includes multiple hyperparameter adjustment cycles, the current hyperparameter set is the hyperparameter set of the current structural adjustment cycle, the optimized hyperparameter set is the hyperparameter set of the next hyperparameter adjustment cycle, the current first neural network is the first neural network of the current structural adjustment cycle, and the first obtaining module is further configured to: determine the first neural network of the next structural adjustment cycle based on the verification result of the third neural network, wherein the number of network blocks included in each network layer of the first neural network of the next structural adjustment cycle is less than the number of network blocks included in each network layer of the first neural network of the current structural adjustment cycle; and obtain the target neural network based on the network of the first neural network of the next structural adjustment cycle and the hyperparameter set of the next structural adjustment cycle, wherein the target neural network is the first neural network whose structure meets the structural conditions.
[0022] In one possible implementation, the verification result of the third neural network includes the verification results of multiple third sub-networks. The third sub-networks include randomly selected network blocks from multiple network blocks at each network level of the third neural network. The first obtaining module is further configured to: determine a fourth sub-network that does not meet the preset accuracy requirement from the multiple third sub-networks based on the verification results of the multiple third sub-networks; statistically analyze the network blocks included in each network level of the preset number of fourth sub-networks to determine a second network block in each network level of the preset number of fourth sub-networks, wherein the second network block is a network block that meets the quantity requirement among the network blocks at each network level of the preset number of fourth sub-networks; and remove the second network block from the third neural network to obtain the first neural network for the next structural adjustment cycle.
[0023] In one possible implementation, the plurality of third sub-networks include a sub-network obtained by randomly sampling multiple network blocks of each network layer of the second neural network corresponding to the third neural network when determining the verification result in the second set, and a sub-network obtained by randomly sampling multiple network blocks of each network layer of the third neural network after determining the third neural network.
[0024] In one possible implementation, the apparatus further includes: a training module, used to train the target neural network using hyperparameters randomly selected from the set of hyperparameters of the structure adjustment period corresponding to the target neural network, and training samples with labeled information, to obtain the trained target neural network.
[0025] In one possible implementation, the target neural network is used to perform any one of text recognition tasks, audio processing tasks, image processing tasks, and video processing tasks.
[0026] According to another aspect of this disclosure, an artificial intelligence chip is provided, the chip including the neural network structure determination device.
[0027] According to another aspect of this disclosure, an electronic device is provided, the electronic device including the artificial intelligence chip.
[0028] According to another aspect of this disclosure, a board is provided, comprising: a storage device, an interface device, a controller, and the artificial intelligence chip; wherein the artificial intelligence chip is connected to the storage device, the controller, and the interface device respectively; the storage device is used to store data; the interface device is used to realize data transmission between the artificial intelligence chip and an external device; and the controller is used to monitor the status of the artificial intelligence chip.
[0029] According to another aspect of this disclosure, an electronic device is provided, comprising: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to invoke the instructions stored in the memory to perform the neural network structure determination method.
[0030] According to another aspect of this disclosure, a computer-readable storage medium is provided that stores computer program instructions thereon, characterized in that the computer program instructions, when executed by a processor, implement the neural network structure determination method.
[0031] According to the neural network structure determination method of the embodiments of this disclosure, in each structure adjustment cycle, the first neural network can be optimized through multiple hyperparameter adjustment cycles to obtain the third neural network with the highest accuracy. Hyperparameters with poor training performance can be removed based on the target hyperparameters or a second set to reduce the hyperparameter set and retain the hyperparameters with good training performance, thus improving selection accuracy. Furthermore, in each structure adjustment cycle, network blocks with low accuracy in the third neural network can be removed to obtain the first neural network for the next structure adjustment cycle. The target neural network is obtained through multiple iterations, retaining the network blocks with the highest accuracy, improving the accuracy of the neural network, and optimizing the structure of the neural network.
[0032] According to one aspect of this disclosure, an electronic device is provided, comprising: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to invoke the instructions stored in the memory to perform the method described above.
[0033] According to one aspect of this disclosure, a computer-readable storage medium is provided that stores computer program instructions thereon, which, when executed by a processor, implement the above-described method.
[0034] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Other features and aspects of this disclosure will become clear from the following detailed description of exemplary embodiments with reference to the accompanying drawings. Attached Figure Description
[0035] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the specification, serve to illustrate the technical solutions of this disclosure.
[0036] Figure 1 A flowchart illustrating a method for determining a neural network structure according to an embodiment of the present disclosure is shown.
[0037] Figure 2 A schematic diagram of a neural network according to an embodiment of the present disclosure is shown;
[0038] Figure 3 A schematic diagram of a neural network according to an embodiment of the present disclosure is shown;
[0039] Figure 4 A schematic diagram of a network block according to an embodiment of the present disclosure is shown;
[0040] Figure 5 A block diagram of a neural network structure determination apparatus according to an embodiment of the present disclosure is shown;
[0041] Figure 6 This is a structural diagram illustrating a combined processing apparatus according to an embodiment of the present disclosure;
[0042] Figure 7 This is a schematic diagram illustrating the structure of a circuit board according to an embodiment of the present disclosure;
[0043] Figure 8 A block diagram of an electronic device according to an embodiment of the present disclosure is shown. Detailed Implementation
[0044] 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 some, not all, of the embodiments of this disclosure. All other embodiments obtained by those skilled in the art based on the embodiments of this disclosure without creative effort are within the scope of protection of this disclosure.
[0045] It should be understood that the terms "first," "second," etc., in the claims, specification, and drawings of this disclosure are used to distinguish different objects, not to describe a specific order. The terms "comprising" and "including" as used in the specification and claims of this disclosure indicate the presence of the described features, integrals, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components, and / or collections thereof.
[0046] It should also be understood that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the scope of this disclosure. As used in this disclosure and claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used in this disclosure and claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes such combinations.
[0047] As used in this specification and claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrase "if determined" or "if [described condition or event] is detected" may be interpreted, depending on the context, as "once determined," "in response to determination," "once [described condition or event] is detected," or "in response to detection of [described condition or event]."
[0048] The neural network structure determination method according to embodiments of this disclosure can be applied to a processor to improve its processing efficiency. The processor can be a general-purpose processor, such as a CPU (Central Processing Unit), or an artificial intelligence processor (IPU) for performing artificial intelligence operations. Artificial intelligence operations can include machine learning operations, neuromorphic operations, etc. Machine learning operations include neural network operations, k-means operations, support vector machine operations, etc. The artificial intelligence processor can, for example, include one or a combination of GPU (Graphics Processing Unit), NPU (Neural-Network Processing Unit), DSP (Digital Signal Processing Unit), and Field-Programmable Gate Array (FPGA) chips. This disclosure does not limit the specific type of processor.
[0049] In one possible implementation, the processor mentioned in this disclosure may include multiple processing units, each of which can independently run various assigned tasks, such as convolution operations, pooling tasks, or fully connected tasks. This disclosure does not limit the processing units or the tasks they run.
[0050] Figure 1 A flowchart illustrating a method for determining a neural network structure according to an embodiment of the present disclosure is shown, the method comprising:
[0051] In step S11, the first sub-network of the current first neural network is trained according to the hyperparameters of the first hyperparameter adjustment period to obtain the second neural network of the first hyperparameter adjustment period. The first neural network includes multiple network layers, each network layer includes multiple network blocks, and the first sub-network includes network blocks randomly selected from the multiple network blocks of each network layer of the first neural network. The hyperparameters of the first hyperparameter adjustment period are selected from the current hyperparameter set.
[0052] In step S12, hyperparameter tuning is performed based on the first set and the second set of the current hyperparameter tuning cycle. Hyperparameters for the next hyperparameter tuning cycle are determined from the current hyperparameter set, and a second neural network for the next hyperparameter tuning cycle is determined. The first set of the current hyperparameter tuning cycle includes the hyperparameters of the current hyperparameter tuning cycle and the hyperparameters of the historical hyperparameter tuning cycles. The second set of the current hyperparameter tuning cycle includes the verification results of the second neural network of the current hyperparameter tuning cycle and the verification results of the second neural network of the historical hyperparameter tuning cycles.
[0053] In step S13, based on the first set and the second set of the last hyperparameter tuning cycle, and the second neural network of multiple hyperparameter tuning cycles, a third neural network and an optimized hyperparameter set are determined, wherein the number of hyperparameters in the optimized hyperparameter set is less than the number of hyperparameters in the current hyperparameter set.
[0054] In step S14, the target neural network is obtained based on the third neural network and the optimized hyperparameter set.
[0055] The neural network structure determination method according to the embodiments of this disclosure can optimize and filter hyperparameters in multiple hyperparameter adjustment cycles to obtain an optimized hyperparameter set, which can be used to determine a more accurate network structure in the structural adjustment of the neural network to achieve higher training accuracy.
[0056] In one possible implementation, the neural network structure determination method can be executed by an electronic device such as a terminal device or a server. The terminal device can be a user equipment (UE), mobile device, user terminal, terminal, cellular phone, cordless phone, personal digital assistant (PDA), handheld device, computing device, in-vehicle device, wearable device, etc. The method can be implemented by a processor calling computer-readable instructions stored in memory. Alternatively, the method can be executed by a server.
[0057] In one possible implementation, during machine learning, the hyperparameters used in training (e.g., optimizer type, learning rate, weight decay, fit ratio, etc.) and the neural network structure can both influence the final training accuracy of the neural network. Typically, preset hyperparameters can be used to determine a suitable neural network structure and then trained to obtain the trained neural network. However, preset hyperparameters may not be accurate, potentially leading to an unsuitable neural network structure and affecting the accuracy. Therefore, hyperparameter optimization (HPO) and neural architecture search (NAS) can be combined for optimization.
[0058] In one possible implementation, both hyperparameter optimization and neural network architecture search can be iterated and searched over multiple cycles to determine suitable hyperparameters and neural network architecture. In the example, the above process may include multiple architecture tuning cycles (i.e., searching for a suitable neural network architecture through multiple iterations), and each architecture tuning cycle may include multiple hyperparameter tuning cycles (i.e., in each architecture tuning cycle, the hyperparameter set is optimized through multiple hyperparameter tuning cycles, thereby allowing for the selection of hyperparameters within a more precise range).
[0059] In one possible implementation, as described above, each structural adjustment cycle can include multiple hyperparameter adjustment cycles. In each cycle, hyperparameters are selected from a set of hyperparameters, and the hyperparameter set and the structure of the neural network are optimized through iteration over multiple cycles. In the next structural adjustment cycle, based on the optimized hyperparameter set, hyperparameters are selected again to further optimize the neural network structure and the hyperparameter set. After multiple iterations of structural adjustment cycles, a target neural network that meets the requirements (e.g., the structure meets the requirements) and a hyperparameter set with a narrow selection range and high selection accuracy can be determined. A set of hyperparameters can be selected from this set to train the target neural network that meets the requirements, resulting in better training performance and higher training accuracy.
[0060] In one possible implementation, the neural network that has not been adjusted or trained in any way may first be preprocessed. In the example, the neural network may be a deep learning neural network that includes multiple network layers, each of which may include multiple network blocks.
[0061] Figure 2 A schematic diagram of a neural network according to an embodiment of the present disclosure is shown, such as... Figure 2As shown, the neural network may include multiple stages, and each stage may include multiple network layers.
[0062] Figure 3 A schematic diagram of a neural network according to an embodiment of the present disclosure is shown, such as... Figure 3 As shown, each network layer can include multiple network blocks. In the example, network block b... i,l,n Let i represent the nth network block of the l-th network layer in the i-th stage, where i, l, and n are all positive integers.
[0063] Figure 4 A schematic diagram of a network block according to an embodiment of the present disclosure is shown, such as Figure 4 As shown, the network block can be Figure 4 One of the network blocks shown, for example, b 1,2,3 It can be Figure 4 The network block shown in (a) is shown in (b). 2,2 4 can be Figure 4 The network block shown in (b) is not limited in structure in this disclosure. In the example, the network block in (a) includes 1×1 convolutional layers, normalized layers, activation layers, 3×3 convolutional layers, etc., and may also include bridging residual structures. The network block in (b) includes 1×1 convolutional layers, normalized layers, activation layers, 3×3 convolutional layers with dilation of 2, etc., and may also include bridging residual structures. Figure 4 The network block shown in (c) includes 1×1 convolutional layers, normalization layers, activation layers, 3×3 convolutional layers with dilation of 4, and may also include bridging residual structures. Figure 4 The network block shown in (d) includes normalization layers, activation layers, 3×3 convolutional layers, etc., and may also include bridging residual structures. Figure 4 The network block shown in (e) includes a bridging residual structure. The structure of the network block is not limited to those described above and may include other structures; this disclosure does not limit the structure of the network blocks. In the example, each network block in the first network layer of each stage may have downsampling capabilities; therefore, the first network layer of each stage does not include the network block shown in (e).
[0064] In one possible implementation, due to the large number of network blocks and complex structure of the aforementioned neural network, the network structure can be optimized. During the preprocessing process described above, the unoptimized hyperparameter set HP can be... baseA set of hyperparameters HP0 is selected, and a network block is randomly selected from each network layer of the unoptimized neural network. The sub-network composed of the randomly selected network block is trained using the hyperparameters HP0. For example, samples with labeled information can be input into the sub-network, and the network parameters of the sub-network are adjusted using the processing results and labeled information. During the adjustment process, the selected hyperparameters HP0 are followed. The process of randomly selecting network blocks to form a sub-network and training it according to the hyperparameters HP0 can be iterated multiple times to obtain the preprocessed first neural network SP0 (i.e., the first neural network in the first structure adjustment cycle). In the example, the training samples may include text samples, audio samples, image samples, video samples, etc. This disclosure does not limit the category of training samples.
[0065] In the example, the hyperparameter set HP base Each hyperparameter in the algorithm can have a certain range. For example, the optimizer types include Adam, SGD, and Momentum, with the learning rate ranging from [0.01, 0.5] and the weight decay coefficient ranging from [1e]. -6 5e -4 The range of the coordination ratio is [0, 0.5]. This disclosure does not limit the range of hyperparameters in the hyperparameter set. In subsequent optimizations, the range of the hyperparameter set for each structural adjustment cycle can be smaller than that of the hyperparameter set for the previous structural adjustment cycle. When selecting hyperparameters, a smaller range can be selected, making the selection of hyperparameters more accurate. Furthermore, after each structural adjustment cycle, each layer of the first neural network can reduce a portion of the poorly performing network blocks. That is, the first neural network in the next structural adjustment cycle includes fewer network blocks than the first neural network in the current structural adjustment cycle. Therefore, in the next structural adjustment cycle, network blocks can be randomly selected from fewer network blocks to form subnetworks for training, resulting in better performance of the selected network blocks. Moreover, more accurate hyperparameters can be selected for training from a smaller range of hyperparameter sets, which helps to include better-performing network blocks in the final target neural network and improve the accuracy of the neural network.
[0066] In one possible implementation, in step S11, multiple hyperparameter tuning cycles may be included in the current hyperparameter tuning cycle (e.g., the 1st, 2nd...jth hyperparameter tuning cycle). In the first hyperparameter tuning cycle, the hyperparameter set HP of the current hyperparameter tuning cycle may be... base A set of hyperparameters HP1 is randomly selected for training.
[0067] In one possible implementation, a network block can be randomly selected (e.g., randomly selected with equal probability) from each network layer of the current first neural network SP0 (i.e., the first neural network in the current structural adjustment cycle) to form a first sub-network. Further, the first sub-network can be trained based on the aforementioned hyperparameter HP1. This process of selecting and training network blocks can be iteratively executed multiple times. After adjusting the network parameters of multiple network blocks in the first neural network, a second neural network SP1 can be obtained.
[0068] In one possible implementation, to optimize the hyperparameter set, i.e., to narrow the range of the hyperparameter set, the second neural network can be validated to obtain the validation result of the second neural network, and optimization can be performed based on the validation result. The method further includes: randomly sampling network blocks at each network layer of the second neural network to determine first network blocks from each network layer; determining second sub-networks based on the first network blocks at each network layer; processing training samples with labeled information through the second sub-network to determine a first processing result of the second sub-network; determining the accuracy of the second sub-network based on the first processing result and the labeled information; and determining the validation result of the second neural network based on the accuracy of multiple second sub-networks.
[0069] In one possible implementation, during the current structural adjustment cycle, the second neural network has the same network structure as the first neural network, except that its network parameters differ from those of the first neural network due to the aforementioned training process on the first sub-network. Therefore, the second neural network also includes multiple network layers, and each network layer includes multiple network blocks. The network blocks of each network layer of the second neural network can be randomly sampled using the same method as for determining the first sub-network. For example, one network block can be randomly selected from each network layer, i.e., the first network block. Furthermore, the network composed of the first network blocks constitutes the second sub-network.
[0070] In one possible implementation, a second sub-network can process training samples to obtain a first processing result. For example, if the training samples are images, the second sub-network can process the images to identify target objects within them. Further, the accuracy of the second sub-network can be determined based on the first processing result and annotation information. That is, multiple training samples can be input into the second sub-network, and the first processing result and annotation information output each time can be compared to determine the accuracy of the second sub-network. For example, multiple images can be input into the second sub-network, and the second sub-network can output multiple recognition results. The recognition accuracy of the multiple recognition results can be statistically calculated based on the image annotation information and used as the accuracy of the second sub-network.
[0071] In one possible implementation, multiple second sub-networks can be obtained through the above method, and the accuracy of each second sub-network can be determined separately. Further, the validation result of the second neural network can be determined based on the accuracy of the multiple second sub-networks. The validation result includes the average accuracy of the multiple second sub-networks. In the example, 10 second sub-networks were obtained through random sampling, and each second sub-network processed 1000 training samples to calculate the accuracy of each second sub-network. Further, the accuracy of the 10 second sub-networks can be averaged to obtain the average accuracy, i.e., the validation result of the second neural network. In another example, the number of training samples processed by each second sub-network can be different; for example, the first second sub-network processed 2000 training samples, the second second sub-network processed 1000 training samples, and so on. When determining the average accuracy, the accuracy of each second sub-network can be weighted and averaged according to the number of training samples processed by each second sub-network to obtain the average accuracy of the multiple second sub-networks, i.e., the validation result of the second neural network.
[0072] In one possible implementation, the above method yields a first set and a second set for the first hyperparameter tuning cycle. The first set includes the hyperparameter HP1 used during the training of the first sub-network of the first neural network SP0 in the first hyperparameter tuning cycle; that is, the first set is {HP1}. The second set includes the validation results of the second neural network SP1 in the first hyperparameter tuning cycle. That is, the second set is Based on the first set and the second set, the hyperparameters HP2 of the second hyperparameter tuning cycle and the second neural network SP2 of the second hyperparameter tuning cycle can be determined.
[0073] In one possible implementation, the first and second sets can be used as input parameters to perform hyperparameter optimization. In the example, hyperparameter optimization can be performed using methods such as random search algorithm, grid search algorithm, simulated annealing algorithm, and Bayesian optimization algorithm. That is, by using the first and second sets as input parameters of the above algorithms, the hyperparameter HP2 for the second hyperparameter adjustment period can be selected from the hyperparameter set of the current structure adjustment period.
[0074] In one possible implementation, the network blocks of each network layer in the first neural network SP0 can be randomly sampled in the same way as described above to obtain the first sub-network. The first sub-network is then trained using the hyperparameter HP2 of the second hyperparameter adjustment period. That is, the first sub-network is trained using training samples with labeled information based on the hyperparameter HP2. After multiple iterations of the random sampling and training processes, the network parameters of at least some network blocks in the first neural network SP0 are adjusted to obtain the second neural network SP2 of the second hyperparameter adjustment period.
[0075] In one possible implementation, the verification results of the second neural network SP2 can be obtained in the same manner as described above. For example, random sampling can be performed on each network layer of the second neural network SP2, and a first network block can be selected from each network layer to form a second sub-network. The accuracy of the second sub-network can then be determined using training samples with labeled information. Furthermore, the accuracies of multiple second sub-networks can be averaged or weighted to determine the average accuracy of the multiple second sub-networks, i.e., the validation result of the second neural network SP2.
[0076] In one possible implementation, the above processing yields the verification results for the hyperparameters HP2 and the second neural network SP2. In the second hyperparameter tuning cycle, the first set may include the hyperparameters HP1 from the first hyperparameter tuning cycle and HP2 from the second hyperparameter tuning cycle; that is, the first set is {HP1, HP2}. The second set may include the validation results of the second neural network SP1. And the validation results of the second neural network SP2 That is, the second set is
[0077] In one possible implementation, the above process continues, namely, the hyperparameter HP3 of the third hyperparameter adjustment cycle can be determined through the first set and the second set, and the first sub-network of the first neural network SP0 is trained based on the hyperparameter HP3 to obtain the second neural network SP3. Furthermore, the verification result of the second neural network SP3 can be determined. Therefore, in the third hyperparameter tuning cycle, the first set is {HP1, HP2, HP3}, and the second set is...
[0078] In one possible implementation, the above process can be performed iteratively. Specifically, in step S12, hyperparameter tuning is performed based on the first set and the second set of current hyperparameter tuning cycles to determine the hyperparameters for the next hyperparameter tuning cycle from the current hyperparameter set. The first sub-network of the first neural network SP0 is then trained based on the hyperparameters for the next hyperparameter tuning cycle to obtain the second neural network for the next hyperparameter tuning cycle. Further, the second neural network for the next hyperparameter tuning cycle can be validated. This involves obtaining multiple second sub-networks of the second neural network through random sampling and determining the average accuracy of these multiple sub-networks as the validation result of the second neural network. The first set of current hyperparameter tuning cycles includes the hyperparameters of the current hyperparameter tuning cycle and the hyperparameters of historical hyperparameter tuning cycles. The second set of current hyperparameter tuning cycles includes the validation results of the second neural network for the current hyperparameter tuning cycle and the validation results of the second neural network for historical hyperparameter tuning cycles.
[0079] In one possible implementation, after t iterations of hyperparameter tuning cycles (i.e., performing the above processing iteration t times, where t is a positive integer), a first set {HP1, HP2, ..., HP...} of t sets of hyperparameters can be obtained. t} and a second set including t verification results A second neural network SP1, SP2…SP was also obtained with t hyperparameter adjustment cycles. t .
[0080] In one possible implementation, in step S13, a third neural network and an optimized hyperparameter set can be determined based on the first set and second set of the last hyperparameter tuning cycle, and the second neural networks of multiple hyperparameter tuning cycles. The last hyperparameter tuning cycle is the t-th hyperparameter tuning cycle, and the first set, second set, and second neural network of the t-th hyperparameter tuning cycle are as shown above. The third neural network and the optimized hyperparameter set can be determined based on the aforementioned first set, second set, and second neural network. The third neural network can be the second neural network with the highest accuracy in the verification results, that is, the best-performing neural network among multiple second neural networks. The optimized hyperparameter set is the hyperparameter set after reducing the hyperparameter set of the current structure tuning cycle (i.e., removing hyperparameters with poor training performance), that is, the number of hyperparameters in the optimized hyperparameter set is less than the number of hyperparameters in the current hyperparameter set. The optimized hyperparameter set can be used as the hyperparameter set for the next structure tuning cycle.
[0081] In one possible implementation, step S13 may include: determining a target hyperparameter in a first set of the last hyperparameter tuning cycle based on a second set of the last hyperparameter tuning cycle; determining the second neural network of the hyperparameter tuning cycle corresponding to the target hyperparameter as the third neural network; and reducing the hyperparameter set of the current structure tuning cycle based on the second set of the last hyperparameter tuning cycle or the target hyperparameter to obtain the optimized hyperparameter set.
[0082] In one possible implementation, the second set of the last hyperparameter tuning cycle, i.e., the second set of the t-th hyperparameter tuning cycle, is: The verification result with the highest accuracy can be determined from this set. For example, the second neural network SP in the k-th (k is a positive integer less than or equal to t) hyperparameter adjustment cycle. k The verification results show the highest accuracy; therefore, the hyperparameter HP in the k-th hyperparameter adjustment cycle can be considered the highest. k The training effect is best. Therefore, the first set {HP1, HP2, ..., HP...} of the t-th hyperparameter adjustment period can be used. t The hyperparameter HP in} k HP was determined as the target hyperparameter * And it can also verify the second neural network SP, which has the highest accuracy in the verification results. k It was determined to be the third neural network SP * Target hyperparameter HP * It can be used to optimize the hyperparameter set of the current structural adjustment cycle; that is, by reducing the hyperparameters with poor training performance, an optimized hyperparameter set is obtained, which is the hyperparameter set for the next structural adjustment cycle. Third Neural Network SP * The first neural network SP0 can be used to obtain the next structural adjustment cycle after optimization.
[0083] In one possible implementation, the hyperparameter set of the current structure adjustment cycle is reduced based on the second set of the last hyperparameter adjustment cycle or the target hyperparameter to obtain the optimized hyperparameter set. This includes: when the hyperparameters are continuous variables, retaining hyperparameters within a preset neighborhood centered on the target hyperparameter and removing hyperparameters outside the preset neighborhood. In the example, hyperparameters may include optimizer type, learning rate, weight decay coefficient, fit ratio, etc., where the learning rate, weight decay coefficient, and fit ratio are continuous variables. During the reduction process, hyperparameters within a preset neighborhood centered on the target hyperparameter can be retained. For example, in the current hyperparameter set, the learning rate range is [0.01, 0.5], and the target hyperparameter HP... *In the example, if the learning rate is 0.3, then 0.3 can be used as the neighborhood center, and the neighborhood radius can be preset (e.g., 0.2). Therefore, the preset hyperparameter range within the neighborhood is [0.1, 0.5], and the range of hyperparameters to be removed is [0.01, 0.1]. In the hyperparameter set of the next structure adjustment cycle, the learning rate range is [0.1, 0.5]. This disclosure does not impose restrictions on the neighborhood center and neighborhood radius.
[0084] In one possible implementation, the hyperparameter set of the current structure adjustment cycle is reduced based on the second set of the last hyperparameter adjustment cycle or the target hyperparameter to obtain the optimized hyperparameter set. This includes: removing a first hyperparameter when the hyperparameter is a discrete variable, wherein the validation result of the second neural network corresponding to the first hyperparameter does not meet the accuracy condition. That is, when the hyperparameter is a discrete variable, the first hyperparameter to be removed can be determined based on the second set of the t-th hyperparameter adjustment cycle. In the example, the second set of the t-th hyperparameter adjustment cycle can be used as the basis for this process. In this process, one or more validation results with the lowest accuracy are identified, and the hyperparameters corresponding to these results can be removed. In the example, the optimizer type is a discrete variable, which can include three types: adam, sgd, and momentum. For example, in the second set... In this process, T (where T is a positive integer less than t) validation results with the lowest accuracy are identified, and T sets of hyperparameters in the first set corresponding to these T validation results can be determined. Further, the most frequently used hyperparameter in these T sets can be statistically analyzed and identified as the hyperparameter with the worst training performance (i.e., the first hyperparameter) for removal. For example, if momentum is the most frequently used hyperparameter among the T hyperparameters, then momentum can be considered the hyperparameter with the worst training performance and can be removed. Therefore, in the hyperparameter set of the next structural adjustment cycle, the optimizer types can only include Adam and SGD. This disclosure does not impose any restrictions on the retained hyperparameters.
[0085] In this way, hyperparameters with poor training performance can be selected and removed based on the target hyperparameters or a second set, thereby reducing the hyperparameter set and retaining the hyperparameters with good training performance. This process can improve the selection accuracy and training performance.
[0086] In one possible implementation, in step S14, the third neural network SP can be optimized using the optimized hyperparameter set. * Further optimization is performed to refine the structure of the third neural network and obtain the target neural network. In the example, the third neural network SP of the current structure can be adjusted periodically. *Optimization is performed to reduce the number of network blocks in each network layer, resulting in the first neural network SP0 for the next structural adjustment cycle. Furthermore, the first neural network SP0 for the next structural adjustment cycle can be optimized through multiple hyperparameter adjustment cycles within the next structural adjustment cycle (the optimization process is consistent with the iterative process of multiple hyperparameter adjustment cycles in the current structural adjustment cycle), resulting in the third neural network SP for the next structural adjustment cycle. * After reducing the number of network blocks in each network layer, the first neural network SP0 in the next structural adjustment cycle can be obtained... The optimization process of the above structural adjustment cycle can be iterated until the first neural network that meets the structural conditions is obtained. In the example, the structural conditions may include each network layer having only one network block, and this disclosure does not impose any restrictions on the structural conditions.
[0087] In one possible implementation, step S14 may include: determining a first neural network for the next structural adjustment cycle based on the verification result of the third neural network, wherein the number of network blocks in each network layer of the first neural network for the next structural adjustment cycle is less than the number of network blocks in each network layer of the first neural network for the current structural adjustment cycle; obtaining the target neural network based on the network of the first neural network for the next structural adjustment cycle and the hyperparameter set for the next structural adjustment cycle, wherein the target neural network is a first neural network whose structure meets the structural conditions.
[0088] In one possible implementation, as described above, the number of network blocks at each network level of the third neural network can be reduced based on the verification results of the third neural network. The verification results of the third neural network include the verification results of multiple third sub-networks, each of which includes randomly selected network blocks from multiple network blocks at each network level of the third neural network. Determining the first neural network for the next structural adjustment cycle based on the verification results of the third neural network includes: identifying fourth sub-networks that do not meet a preset accuracy requirement from among the multiple third sub-networks based on their verification results; statistically analyzing the network blocks at each network level of the preset number of fourth sub-networks to determine second network blocks at each network level within the preset number of fourth sub-networks, wherein the second network block is a network block that meets the quantity requirement among the network blocks at each network level of the preset number of fourth sub-networks; and removing the second network block from the third neural network to obtain the first neural network for the next structural adjustment cycle.
[0089] In one possible implementation, the random sampling of each network layer of the third neural network can be performed in a manner similar to that described above for obtaining the first or second sub-network, and will not be repeated here. The plurality of third sub-networks includes sub-networks obtained by randomly sampling multiple network blocks at each network layer of the second neural network corresponding to the third neural network when determining the verification result in the second set, and sub-networks obtained by randomly sampling multiple network blocks at each network layer of the third neural network after determining the third neural network. In the example, the third neural network can be randomly sampled p times (p is a positive integer), resulting in p third sub-networks. Furthermore, since the third neural network is the second neural network with the highest accuracy in the verification result, and multiple second sub-networks have already been randomly sampled multiple times when determining the verification result of the second neural network, for example, m (m is a positive integer) second sub-networks were obtained. Therefore, the m second sub-networks of the third neural network can also be considered as third sub-networks, resulting in a total of m+p third sub-networks.
[0090] In one possible implementation, the aforementioned third sub-network can be validated. For example, the third sub-network can process training samples with labeled information, and the processing results can be compared with the labeled information to determine the accuracy of each third sub-network. Furthermore, based on the accuracy of each third sub-network, a fourth sub-network that does not meet the accuracy requirements can be determined. For example, the b (where b is a positive integer less than m+p) third sub-networks with the lowest accuracy can be identified as the fourth sub-network.
[0091] In one possible implementation, network blocks in multiple fourth sub-networks can be statistically analyzed to determine the second network blocks that meet the quantity requirements at each level. For example, if b = 1000, meaning a total of 1000 fourth sub-networks are obtained, the network blocks at each level of these 1000 fourth sub-networks can be statistically analyzed to determine the second network blocks that meet the quantity requirements. For instance, if in the a-th (a is a positive integer) network level, the fourth sub-network using the c-th (c is a positive integer) network block exceeds the quantity threshold (e.g., 500), then the c-th network block of that network level can be determined as the second network block. Alternatively, one or more network blocks with the highest usage rate in each network level can be statistically analyzed, and these one or more network blocks can be determined as the second network blocks.
[0092] In one possible implementation, since the fourth sub-network has low accuracy, it can be determined that the second network block, which has a high usage rate, also has low accuracy and poor performance. Therefore, the second network block of the third neural network can be removed, and the first neural network for the next structure adjustment cycle can be obtained. The first neural network in the next structure adjustment cycle includes fewer network blocks than the first neural network in the current structure adjustment cycle.
[0093] In one possible implementation, a fifth subnetwork that meets the accuracy requirements can be determined based on the verification results of the third subnetwork. The most frequently used third network blocks at each network layer of the multiple fifth subnetworks can then be identified, and these third network blocks in the third neural network can be retained while other network blocks are removed to obtain the first neural network for the next structural adjustment cycle. This disclosure does not limit the method of removing network blocks.
[0094] In one possible implementation, the first neural network for the next structural adjustment cycle can be optimized based on hyperparameters selected from the hyperparameter set for that cycle. The optimization process can follow the multi-hyperparameter adjustment cycle processing described above, resulting in a third neural network for the next structural adjustment cycle. Further, the number of network blocks in the third neural network for the next structural adjustment cycle can be reduced as described above to obtain the first neural network for the next subsequent structural adjustment cycle… This process can be iteratively executed until a first neural network meeting the structural conditions, i.e., the target neural network, is obtained. In this example, each network layer of the target neural network includes only one network block. This disclosure does not limit the network structure of the target neural network.
[0095] In this way, the first neural network for the next structural adjustment cycle can be obtained by removing the network blocks with low accuracy in the third neural network. The target neural network can be obtained through iterative processing. After multiple iterations, the network blocks with the highest accuracy can be selected in each layer of the neural network, thereby improving the accuracy of the neural network and simplifying its structure.
[0096] In one possible implementation, the target neural network can be further trained to further improve its performance. The method further includes: training the target neural network using hyperparameters randomly selected from the hyperparameter set of the structural adjustment period corresponding to the target neural network, and training samples with labeled information, to obtain a trained target neural network. In the example, the structural adjustment period corresponding to the target neural network is the structural adjustment period that makes the first neural network meet the structural conditions. For example, it is a structural adjustment period in which each network layer of the first neural network includes only one network block (e.g., the last structural adjustment period). In this structural adjustment period, the hyperparameter set is reduced to a smaller range, and the training effect of the hyperparameters in the hyperparameter set is better. Hyperparameters can be randomly selected from the hyperparameter set of this structural adjustment period, and based on the selected hyperparameters, multiple training samples with labeled information are used for training to further improve the accuracy of the target neural network, obtaining a trained target neural network.
[0097] In one possible implementation, the training samples may include any one of the following: text samples, audio samples, image samples, video samples, etc. This disclosure does not limit the type of training samples. The target neural network can be used to perform any one of the following tasks: text recognition, audio processing, image processing, and video processing. This disclosure does not limit the application of the target neural network.
[0098] According to the neural network structure determination method of the embodiments of this disclosure, in each structure adjustment cycle, the first neural network can be optimized through multiple hyperparameter adjustment cycles to obtain the third neural network with the highest accuracy. Hyperparameters with poor training performance can be removed based on the target hyperparameters or a second set to reduce the hyperparameter set and retain the hyperparameters with good training performance, thus improving selection accuracy. Furthermore, in each structure adjustment cycle, network blocks with low accuracy in the third neural network can be removed to obtain the first neural network for the next structure adjustment cycle. The target neural network is obtained through multiple iterations, retaining the network blocks with the highest accuracy, improving the accuracy of the neural network, and optimizing the structure of the neural network.
[0099] Figure 5 A block diagram of a neural network structure determination apparatus according to an embodiment of the present disclosure is shown, such as Figure 6As shown, the device includes: a first training module 11, used to train a first sub-network of the current first neural network according to the hyperparameters of the first hyperparameter adjustment period, to obtain a second neural network for the first hyperparameter adjustment period, wherein the first neural network includes multiple network layers, each network layer includes multiple network blocks, the first sub-network includes network blocks randomly selected from the multiple network blocks of each network layer of the first neural network, and the hyperparameters of the first hyperparameter adjustment period are selected from the current hyperparameter set; and a hyperparameter adjustment module 12, used to perform hyperparameter adjustment processing according to the first set and the second set of the current hyperparameter adjustment period, to determine the hyperparameters of the next hyperparameter adjustment period from the current hyperparameter set, and to determine the next... A second neural network for hyperparameter tuning cycles, wherein the first set of current hyperparameter tuning cycles includes hyperparameters of the current hyperparameter tuning cycle and hyperparameters of historical hyperparameter tuning cycles, and the second set of current hyperparameter tuning cycles includes verification results of the second neural network of the current hyperparameter tuning cycle and verification results of the second neural network of historical hyperparameter tuning cycles; a first optimization module 13 is used to determine a third neural network and an optimized hyperparameter set based on the first set and second set of the last hyperparameter tuning cycle and the second neural networks of multiple hyperparameter tuning cycles, wherein the number of hyperparameters in the optimized hyperparameter set is less than the number of hyperparameters in the current hyperparameter set; and a first obtaining module 14 is used to obtain a target neural network based on the third neural network and the optimized hyperparameter set.
[0100] In one possible implementation, the apparatus further includes a verification result determination module, configured to: randomly sample network blocks at each network layer of the second neural network to determine a first network block from each network layer; determine a second sub-network based on the first network blocks at each network layer; process training samples with labeled information through the second sub-network to determine a first processing result of the second sub-network; determine the accuracy of the second sub-network based on the first processing result and the labeled information; and determine the verification result of the second neural network based on the accuracy of multiple second sub-networks.
[0101] In one possible implementation, the verification results include the average accuracy of multiple second sub-networks.
[0102] In one possible implementation, the first optimization module is further configured to: determine a target hyperparameter in a first set of the last hyperparameter adjustment cycle based on a second set of the last hyperparameter adjustment cycle; determine the second neural network of the hyperparameter adjustment cycle corresponding to the target hyperparameter as the third neural network; and reduce the hyperparameter set of the current structure adjustment cycle based on the second set of the last hyperparameter adjustment cycle or the target hyperparameter to obtain the optimized hyperparameter set.
[0103] In one possible implementation, the first optimization module is further configured to: retain hyperparameters within a preset neighborhood centered on the target hyperparameter when the hyperparameters are continuous variables, and remove hyperparameters outside the preset neighborhood.
[0104] In one possible implementation, the first optimization module is further configured to: remove the first hyperparameter when the hyperparameter is a discrete variable, wherein the verification result of the second neural network corresponding to the first hyperparameter does not meet the accuracy condition.
[0105] In one possible implementation, the structural adjustment cycle includes multiple hyperparameter adjustment cycles, the current hyperparameter set is the hyperparameter set of the current structural adjustment cycle, the optimized hyperparameter set is the hyperparameter set of the next hyperparameter adjustment cycle, the current first neural network is the first neural network of the current structural adjustment cycle, and the first obtaining module is further configured to: determine the first neural network of the next structural adjustment cycle based on the verification result of the third neural network, wherein the number of network blocks included in each network layer of the first neural network of the next structural adjustment cycle is less than the number of network blocks included in each network layer of the first neural network of the current structural adjustment cycle; and obtain the target neural network based on the network of the first neural network of the next structural adjustment cycle and the hyperparameter set of the next structural adjustment cycle, wherein the target neural network is the first neural network whose structure meets the structural conditions.
[0106] In one possible implementation, the verification result of the third neural network includes the verification results of multiple third sub-networks. The third sub-networks include randomly selected network blocks from multiple network blocks at each network level of the third neural network. The first obtaining module is further configured to: determine a fourth sub-network that does not meet the preset accuracy requirement from the multiple third sub-networks based on the verification results of the multiple third sub-networks; statistically analyze the network blocks included in each network level of the preset number of fourth sub-networks to determine a second network block in each network level of the preset number of fourth sub-networks, wherein the second network block is a network block that meets the quantity requirement among the network blocks at each network level of the preset number of fourth sub-networks; and remove the second network block from the third neural network to obtain the first neural network for the next structural adjustment cycle.
[0107] In one possible implementation, the plurality of third sub-networks include a sub-network obtained by randomly sampling multiple network blocks of each network layer of the second neural network corresponding to the third neural network when determining the verification result in the second set, and a sub-network obtained by randomly sampling multiple network blocks of each network layer of the third neural network after determining the third neural network.
[0108] In one possible implementation, the apparatus further includes: a training module, used to train the target neural network using hyperparameters randomly selected from the set of hyperparameters of the structure adjustment period corresponding to the target neural network, and training samples with labeled information, to obtain the trained target neural network.
[0109] In one possible implementation, the target neural network is used to perform any one of text recognition tasks, audio processing tasks, image processing tasks, and video processing tasks.
[0110] Figure 6 This is a structural diagram illustrating a combined processing apparatus 1200 according to an embodiment of the present disclosure. Figure 6 As shown, the combined processing device 1200 includes a computing processing device 1202, an interface device 1204, other processing devices 1206, and a storage device 1208. Depending on the application scenario, the computing processing device may include one or more computing devices 1210, which can be configured to perform the functions described herein. Figure 2 The described operation.
[0111] In different embodiments, the computing processing apparatus of this disclosure can be configured to perform user-specified operations. In exemplary applications, the computing processing apparatus can be implemented as a single-core artificial intelligence processor or a multi-core artificial intelligence processor. Similarly, one or more computing devices included within the computing processing apparatus can be implemented as an artificial intelligence processor core or a portion of the hardware structure of an artificial intelligence processor core. When multiple computing devices are implemented as artificial intelligence processor cores or a portion of the hardware structure of an artificial intelligence processor core, the computing processing apparatus of this disclosure can be considered to have a single-core structure or a homogeneous multi-core structure.
[0112] In exemplary operation, the computing processing device of this disclosure can interact with other processing devices through interface devices to jointly complete user-specified operations. Depending on the implementation, other processing devices of this disclosure may include one or more types of processors such as a central processing unit (CPU), a graphics processing unit (GPU), and an artificial intelligence processor, both general-purpose and / or special-purpose processors. These processors may include, but are not limited to, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., and their number can be determined according to actual needs. As mentioned above, the computing processing device of this disclosure can be considered to have a single-core structure or a homogeneous multi-core structure. However, when the computing processing device and other processing devices are considered together, they can be considered to form a heterogeneous multi-core structure.
[0113] In one or more embodiments, the other processing device may serve as an interface between the computing processing device of this disclosure (which may be specifically embodied in artificial intelligence, such as neural network operations) and external data and control, performing basic controls including but not limited to data transfer, starting and / or stopping the computing device. In another embodiment, the other processing device may also cooperate with the computing processing device to jointly complete the computational task.
[0114] In one or more embodiments, the interface device can be used to transfer data and control commands between a computing processing device and other processing devices. For example, the computing processing device can obtain input data from other processing devices via the interface device and write it to on-chip storage (or memory) of the computing processing device. Further, the computing processing device can obtain control commands from other processing devices via the interface device and write them to on-chip control cache of the computing processing device. Alternatively or optionally, the interface device can also read data from the storage device of the computing processing device and transmit it to other processing devices.
[0115] Additionally or optionally, the combined processing apparatus of this disclosure may further include a storage device. As shown in the figures, the storage device is connected to both the computing processing device and the other processing device. In one or more embodiments, the storage device may be used to store data from the computing processing device and / or the other processing device. For example, the data may be data that cannot be fully stored in the internal or on-chip storage of the computing processing device or other processing device.
[0116] In some embodiments, this disclosure also discloses an artificial intelligence chip (e.g. Figure 8 The chip 1302 shown includes the aforementioned neural network structure determination device. In one implementation, the chip is a system-on-a-chip (SoC) and integrates one or more combined processing devices. The chip can communicate via external interface devices (such as… Figure 8 The external interface device 1306 shown is connected to other related components. These related components may be, for example, a camera, monitor, mouse, keyboard, network card, or Wi-Fi interface. In some applications, the chip may integrate other processing units (e.g., video codecs) and / or interface modules (e.g., DRAM interfaces). In some embodiments, this disclosure also discloses a chip package structure that includes the aforementioned chip. In some embodiments, this disclosure also discloses a board that includes the aforementioned chip package structure. The following will be combined with… Figure 8 This board is described in detail.
[0117] Figure 7 This is a schematic diagram illustrating the structure of a board 1300 according to an embodiment of the present disclosure. For example... Figure 7As shown, the board includes a storage device 1304 for storing data, which includes one or more storage cells 1310. This storage device can connect and transmit data with the controller 1308 and the aforementioned artificial intelligence chip 1302 via, for example, a bus. Furthermore, the board also includes an external interface device 1306, configured for data relay or switching between the chip (or the chip in a chip package) and an external device 1312 (e.g., a server or computer). For example, data to be processed can be transferred from the external device to the chip via the external interface device. Alternatively, the calculation results of the chip can be transmitted back to the external device via the external interface device. Depending on the application scenario, the external interface device can have different interface forms; for example, it can adopt a standard PCIe interface.
[0118] Each group of the storage units is connected to the artificial intelligence chip via a bus. It can be understood that each group of the storage units can be DDR SDRAM (Double Data Rate SDRAM).
[0119] DDR can double the speed of SDRAM without increasing the clock frequency. DDR allows data to be read on both the rising and falling edges of the clock pulse. DDR is twice as fast as standard SDRAM. In one embodiment, the storage device may include four groups of storage cells. Each group of storage cells may include multiple DDR4 chips. In one embodiment, the AI chip may internally include four 72-bit DDR4 controllers, of which 64 bits are used for data transmission and 8 bits are used for ECC verification. It can be understood that when DDR4-3200 chips are used in each group of storage cells, the theoretical data transmission bandwidth can reach 25600MB / s.
[0120] In one embodiment, each group of memory cells includes multiple Double Data Rate (DDR) synchronous dynamic random access memories (DRAMs) arranged in parallel. DDR can transfer data twice within one clock cycle. A controller for controlling the DDR is provided in the chip for controlling the data transfer and data storage of each memory cell.
[0121] The interface device is electrically connected to the artificial intelligence chip. The interface device is used to realize data transmission between the artificial intelligence chip and external devices (e.g., servers or computers). For example, in one embodiment, the interface device can be a standard PCIe interface. For instance, data to be processed is transferred from the server to the chip via a standard PCIe interface, realizing data transfer. Preferably, when using a PCIe 3.0 x 16 interface, the theoretical bandwidth can reach 16000 MB / s. In another embodiment, the interface device can also be other interfaces; this disclosure does not limit the specific form of the other interfaces mentioned above, as long as the interface unit can realize the switching function. Furthermore, the calculation results of the artificial intelligence chip are still transmitted back to the external device (e.g., the server) by the interface device.
[0122] The controller is electrically connected to the artificial intelligence chip. The controller is used to regulate the state of the artificial intelligence chip. Specifically, the artificial intelligence chip and the controller can be electrically connected via an SPI interface. The controller may include a microcontroller (MCU). The artificial intelligence chip may include multiple processing chips, multiple processing cores, or multiple processing circuits, and can drive multiple loads. Therefore, the artificial intelligence chip can operate in different states, such as high load and low load. The controller can regulate the operating states of multiple processing chips, multiple processing cores, and / or multiple processing circuits within the artificial intelligence chip.
[0123] Based on the above combination Figure 7 and Figure 8 Based on the description, those skilled in the art will understand that this disclosure also discloses an electronic device or apparatus that may include one or more of the aforementioned boards, one or more of the aforementioned chips, and / or one or more of the aforementioned combined processing apparatus.
[0124] Depending on the application scenario, the electronic devices or apparatus disclosed herein may include servers, cloud servers, server clusters, data processing devices, robots, computers, printers, scanners, tablet computers, smart terminals, PC devices, IoT terminals, mobile terminals, mobile phones, dashcams, navigators, sensors, cameras, video cameras, projectors, watches, headphones, mobile storage, wearable devices, visual terminals, autonomous driving terminals, vehicles, home appliances, and / or medical devices. The vehicles include airplanes, ships, and / or vehicles; the home appliances include televisions, air conditioners, microwave ovens, refrigerators, rice cookers, humidifiers, washing machines, lights, gas stoves, and range hoods; the medical devices include MRI scanners, ultrasound scanners, and / or electrocardiographs.
[0125] This disclosure also proposes a computer-readable storage medium storing computer program instructions that, when executed by a processor, implement the above-described method. The computer-readable storage medium may be a non-volatile computer-readable storage medium.
[0126] This disclosure also proposes an electronic device, including: a processor; and a memory for storing processor-executable instructions; wherein the processor is configured to invoke the instructions stored in the memory to execute the above-described method.
[0127] Electronic devices can be provided as terminals, servers, or other forms of devices.
[0128] Figure 8 A block diagram of an electronic device 1900 according to an embodiment of the present disclosure is shown. For example, the electronic device 1900 may be provided as a server. (Refer to...) Figure 8 The electronic device 1900 includes a processing component 1922, which further includes one or more processors, and memory resources represented by memory 1932 for storing instructions, such as application programs, that can be executed by the processing component 1922. The application programs stored in memory 1932 may include one or more modules, each corresponding to a set of instructions. Furthermore, the processing component 1922 is configured to execute instructions to perform the methods described above.
[0129] Electronic device 1900 may also include a power supply component 1926 configured to perform power management of electronic device 1900, a wired or wireless network interface 1950 configured to connect electronic device 1900 to a network, and an input / output (I / O) interface 1958. Electronic device 1900 can operate on an operating system stored in memory 1932, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, or similar.
[0130] In an exemplary embodiment, a non-volatile computer-readable storage medium is also provided, such as a memory 1932 including computer program instructions that can be executed by a processing component 1922 of an electronic device 1900 to perform the above-described method.
[0131] It should be noted that, for the sake of brevity, this disclosure describes some methods and their embodiments as a series of actions and combinations thereof. However, those skilled in the art will understand that the solutions of this disclosure are not limited by the order of the described actions. Therefore, based on the disclosure or teachings of this disclosure, those skilled in the art will understand that some steps can be performed in a different order or simultaneously. Furthermore, those skilled in the art will understand that the embodiments described in this disclosure can be considered as optional embodiments, that is, the actions or modules involved are not necessarily essential for the implementation of one or more solutions of this disclosure. In addition, depending on the solution, the description of some embodiments in this disclosure also has different emphases. In view of this, those skilled in the art will understand that parts not described in detail in a certain embodiment of this disclosure can also be referred to the relevant descriptions of other embodiments.
[0132] In terms of specific implementation, based on the disclosure and teachings of this disclosure, those skilled in the art will understand that the several embodiments disclosed herein can also be implemented in other ways not disclosed herein. For example, regarding the various units in the electronic device or apparatus embodiments described above, this document divides them based on logical functions, but in actual implementation, there may be other division methods. As another example, multiple units or components can be combined or integrated into another system, or some features or functions in a unit or component can be selectively disabled. Regarding the connection relationships between different units or components, the connections discussed above in conjunction with the accompanying drawings can be direct or indirect couplings between units or components.
[0133] In this disclosure, the units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units. The aforementioned components or units may be located in the same location or distributed across multiple network units. Furthermore, depending on actual needs, some or all of the units can be selected to achieve the purpose of the solution described in the embodiments of this disclosure. Additionally, in some scenarios, multiple units in the embodiments of this disclosure may be integrated into one unit or each unit may exist physically independently.
[0134] In the above embodiments, the descriptions of each embodiment have their own emphasis. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments. The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as the combination of these technical features does not contradict each other, it should be considered within the scope of this specification.
[0135] The electronic devices or apparatuses disclosed herein can also be applied in fields such as the Internet, the Internet of Things, data centers, energy, transportation, public management, manufacturing, education, power grids, telecommunications, finance, retail, construction sites, and healthcare. Furthermore, the electronic devices or apparatuses disclosed herein can also be used in application scenarios related to artificial intelligence, big data, and / or cloud computing, such as cloud computing, edge computing, and terminals. In one or more embodiments, the high-computing-power electronic devices or apparatuses according to the scheme of this disclosure can be applied to cloud devices (e.g., cloud servers), while the low-power electronic devices or apparatuses can be applied to terminal devices and / or edge devices (e.g., smartphones or cameras). In one or more embodiments, the hardware information of the cloud devices and the hardware information of the terminal devices and / or edge devices are compatible with each other, thereby allowing suitable hardware resources to be matched from the hardware resources of the cloud devices to simulate the hardware resources of the terminal devices and / or edge devices based on the hardware information of the terminal devices and / or edge devices, in order to achieve unified management, scheduling, and collaborative work of end-to-cloud or cloud-edge-end integration.
[0136] The foregoing can be better understood in accordance with the following terms:
[0137] For example, Clause A1, a method for determining a neural network structure, includes: training a first sub-network of a current first neural network based on hyperparameters of a first hyperparameter tuning cycle to obtain a second neural network for the first hyperparameter tuning cycle, wherein the first neural network includes multiple network layers, each network layer includes multiple network blocks, the first sub-network includes network blocks randomly selected from the multiple network blocks of each network layer of the first neural network, and the hyperparameters of the first hyperparameter tuning cycle are selected from the current hyperparameter set; performing hyperparameter tuning processing based on a first set and a second set of the current hyperparameter tuning cycles to determine the hyperparameters of the next hyperparameter tuning cycle from the current hyperparameter set. The process involves determining a second neural network for the next hyperparameter tuning cycle. The first set of current hyperparameter tuning cycles includes the hyperparameters of the current cycle and the hyperparameters of historical cycles. The second set of current hyperparameter tuning cycles includes the validation results of the second neural network for the current cycle and the validation results of the second neural networks for historical cycles. Based on the first and second sets of the last hyperparameter tuning cycle, and the second neural networks from multiple hyperparameter tuning cycles, a third neural network and an optimized hyperparameter set are determined. The number of hyperparameters in the optimized hyperparameter set is less than the number of hyperparameters in the current hyperparameter set. Finally, the target neural network is obtained based on the third neural network and the optimized hyperparameter set.
[0138] Clause A2, according to the method described in Clause A1, further comprising: randomly sampling network blocks at each network layer of the second neural network to determine first network blocks from each network layer; determining second sub-networks based on the first network blocks at each network layer; processing training samples with labeled information through the second sub-network to determine a first processing result of the second sub-network; determining the accuracy of the second sub-network based on the first processing result and the labeled information; and determining the verification result of the second neural network based on the accuracy of multiple second sub-networks.
[0139] Clause A3, pursuant to the method described in Clause A2, wherein the verification results include the average accuracy of multiple second subnetworks.
[0140] Clause A4, according to the method described in Clause A1, determines a third neural network and an optimized hyperparameter set based on a first set and a second set of the last hyperparameter tuning cycle, and a second neural network of multiple hyperparameter tuning cycles, including: determining a target hyperparameter in the first set of the last hyperparameter tuning cycle based on the second set of the last hyperparameter tuning cycle; determining the second neural network of the hyperparameter tuning cycle corresponding to the target hyperparameter as the third neural network; and reducing the hyperparameter set of the current structure tuning cycle based on the second set of the last hyperparameter tuning cycle or the target hyperparameter to obtain the optimized hyperparameter set.
[0141] Clause A5, according to the method described in Clause A4, reduces the hyperparameter set of the current structure adjustment cycle based on the second set of the last hyperparameter adjustment cycle or the target hyperparameter to obtain the optimized hyperparameter set, including: when the hyperparameters are continuous variables, retaining the hyperparameters within a preset neighborhood centered on the target hyperparameter and removing the hyperparameters outside the preset neighborhood.
[0142] Clause A6, according to the method described in Clause A4, reduces the hyperparameter set of the current structure adjustment cycle based on the second set of the last hyperparameter adjustment cycle or the target hyperparameter to obtain the optimized hyperparameter set, including: removing the first hyperparameter when the hyperparameter is a discrete variable, wherein the verification result of the second neural network corresponding to the first hyperparameter does not meet the accuracy condition.
[0143] Clause A7, according to the method described in Clause A1, the structural adjustment cycle includes multiple hyperparameter adjustment cycles, the current hyperparameter set is the hyperparameter set of the current structural adjustment cycle, the optimized hyperparameter set is the hyperparameter set of the next hyperparameter adjustment cycle, the current first neural network is the first neural network of the current structural adjustment cycle, and obtaining the target neural network based on the third neural network and the optimized hyperparameter set includes: determining the first neural network of the next structural adjustment cycle based on the verification result of the third neural network, wherein the number of network blocks included in each network layer of the first neural network of the next structural adjustment cycle is less than the number of network blocks included in each network layer of the first neural network of the current structural adjustment cycle; obtaining the target neural network based on the network of the first neural network of the next structural adjustment cycle and the hyperparameter set of the next structural adjustment cycle, wherein the target neural network is the first neural network whose structure meets the structural conditions.
[0144] Clause A8, according to the method described in Clause A7, the verification result of the third neural network includes the verification results of multiple third sub-networks, the third sub-networks including randomly selected network blocks from multiple network blocks at each network level of the third neural network, wherein determining the first neural network for the next structural adjustment cycle based on the verification results of the third neural network includes: determining a fourth sub-network that does not meet a preset accuracy requirement from the multiple third sub-networks based on the verification results of the multiple third sub-networks; statistically analyzing the network blocks included in each network level of the preset number of fourth sub-networks to determine a second network block in each network level of the preset number of fourth sub-networks, wherein the second network block is a network block that meets the quantity requirement among the network blocks at each network level of the preset number of fourth sub-networks; and removing the second network block from the third neural network to obtain the first neural network for the next structural adjustment cycle.
[0145] Clause A9, according to the method described in Clause A8, the plurality of third sub-networks include a sub-network obtained by randomly sampling a plurality of network blocks of each network layer of the second neural network corresponding to the third neural network when determining the verification result in the second set, and a sub-network obtained by randomly sampling a plurality of network blocks of each network layer of the third neural network after determining the third neural network.
[0146] Clause A10, the method according to Clause A1, further comprising: training the target neural network using hyperparameters randomly selected from the set of hyperparameters of the structural adjustment period corresponding to the target neural network, and training samples with labeled information, to obtain the trained target neural network.
[0147] Clause A11, the method described in Clause A1, wherein the target neural network is used to perform any one of text recognition tasks, audio processing tasks, image processing tasks, and video processing tasks.
[0148] Clause A12, a neural network structure determination apparatus, comprising: a first training module, configured to train a first sub-network of a current first neural network based on hyperparameters of a first hyperparameter adjustment period, to obtain a second neural network of the first hyperparameter adjustment period, wherein the first neural network includes multiple network layers, each network layer includes multiple network blocks, the first sub-network includes network blocks randomly selected from the multiple network blocks of each network layer of the first neural network, and the hyperparameters of the first hyperparameter adjustment period are selected from a current hyperparameter set; and a hyperparameter adjustment module, configured to perform hyperparameter adjustment processing based on a first set and a second set of current hyperparameter adjustment periods, to determine the hyperparameters of the next hyperparameter adjustment period from the current hyperparameter set. The system determines a second neural network for the next hyperparameter tuning cycle. The first set of the current hyperparameter tuning cycles includes the hyperparameters of the current cycle and the hyperparameters of the historical cycles. The second set of the current hyperparameter tuning cycles includes the verification results of the second neural network of the current cycle and the verification results of the second neural network of the historical cycles. A first optimization module is used to determine a third neural network and an optimized hyperparameter set based on the first set and the second set of the last hyperparameter tuning cycle, as well as the second neural networks of multiple hyperparameter tuning cycles. The number of hyperparameters in the optimized hyperparameter set is less than the number of hyperparameters in the current hyperparameter set. A first obtaining module is used to obtain a target neural network based on the third neural network and the optimized hyperparameter set.
[0149] Clause A13, according to the method described in Clause A12, the apparatus further includes a verification result determination module, configured to: randomly sample network blocks at each network layer of the second neural network to determine first network blocks from each network layer; determine second sub-networks based on the first network blocks at each network layer; process training samples with labeled information through the second sub-network to determine a first processing result of the second sub-network; determine the accuracy of the second sub-network based on the first processing result and the labeled information; and determine the verification result of the second neural network based on the accuracy of multiple second sub-networks.
[0150] Clause A14, pursuant to the method described in Clause A13, wherein the verification results include the average accuracy of multiple second subnetworks.
[0151] Clause A15, according to the method described in Clause A12, the first optimization module is further configured to: determine a target hyperparameter in a first set of the last hyperparameter adjustment cycle based on a second set of the last hyperparameter adjustment cycle; determine the second neural network of the hyperparameter adjustment cycle corresponding to the target hyperparameter as the third neural network; and reduce the hyperparameter set of the current structure adjustment cycle based on the second set of the last hyperparameter adjustment cycle or the target hyperparameter to obtain the optimized hyperparameter set.
[0152] Clause A16, according to the method described in Clause A15, the first optimization module is further configured to: retain hyperparameters within a preset neighborhood centered on the target hyperparameter when the hyperparameter is a continuous variable, and remove hyperparameters outside the preset neighborhood.
[0153] Clause A17, according to the method described in Clause A15, the first optimization module is further configured to: remove the first hyperparameter when the hyperparameter is a discrete variable, wherein the verification result of the second neural network corresponding to the first hyperparameter does not meet the accuracy condition.
[0154] Clause A18, according to the method described in Clause A12, the structural adjustment cycle includes multiple hyperparameter adjustment cycles, the current hyperparameter set is the hyperparameter set of the current structural adjustment cycle, the optimized hyperparameter set is the hyperparameter set of the next hyperparameter adjustment cycle, the current first neural network is the first neural network of the current structural adjustment cycle, and the first obtaining module is further configured to: determine the first neural network of the next structural adjustment cycle based on the verification result of the third neural network, wherein the number of network blocks included in each network layer of the first neural network of the next structural adjustment cycle is less than the number of network blocks included in each network layer of the first neural network of the current structural adjustment cycle; and obtain the target neural network based on the network of the first neural network of the next structural adjustment cycle and the hyperparameter set of the next structural adjustment cycle, wherein the target neural network is the first neural network whose structure meets the structural conditions.
[0155] Clause A19, according to the method described in Clause A18, the verification result of the third neural network includes the verification results of multiple third sub-networks, the third sub-networks including randomly selected network blocks from multiple network blocks at each network level of the third neural network, the first obtaining module is further configured to: determine a fourth sub-network that does not meet the preset accuracy requirement from the multiple third sub-networks based on the verification results of the multiple third sub-networks; statistically analyze the network blocks included in each network level of the preset number of fourth sub-networks to determine a second network block in each network level of the preset number of fourth sub-networks, wherein the second network block is a network block that meets the quantity requirement among the network blocks at each network level of the preset number of fourth sub-networks; remove the second network block from the third neural network to obtain the first neural network for the next structural adjustment cycle.
[0156] Clause A20, the method according to Clause A19, wherein the plurality of third sub-networks includes a sub-network obtained by randomly sampling a plurality of network blocks of each network layer of the second neural network corresponding to the third neural network when determining the verification result in the second set, and a sub-network obtained by randomly sampling a plurality of network blocks of each network layer of the third neural network after determining the third neural network.
[0157] Clause A21, according to the method described in Clause A12, the apparatus further includes: a training module, configured to train the target neural network using hyperparameters randomly selected from a set of hyperparameters of the structure adjustment period corresponding to the target neural network, and training samples with labeled information, to obtain a trained target neural network.
[0158] Clause A22, the method described in Clause A12, wherein the target neural network is used to perform any one of a text recognition task, an audio processing task, an image processing task, and a video processing task.
[0159] While numerous embodiments of this disclosure have been shown and described herein, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Many modifications, alterations, and alternatives will occur to those skilled in the art without departing from the spirit and intent of this disclosure. It should be understood that various alternatives to the embodiments of this disclosure described herein may be employed in the practice of this disclosure. The appended claims are intended to define the scope of this disclosure and therefore cover equivalents or alternatives within the scope of those claims.
Claims
1. A method for determining a neural network structure, characterized in that, include: Based on the hyperparameters of the first hyperparameter adjustment period, the first sub-network of the current first neural network is trained to obtain the second neural network of the first hyperparameter adjustment period. The first neural network includes multiple network layers, each network layer includes multiple network blocks, and the first sub-network includes network blocks randomly selected from the multiple network blocks of each network layer of the first neural network. The hyperparameters of the first hyperparameter adjustment period are selected from the current hyperparameter set. Based on the first set and the second set of the current hyperparameter tuning cycle, hyperparameter tuning is performed. Hyperparameters for the next hyperparameter tuning cycle are determined from the current hyperparameter set. The first sub-network is trained based on the hyperparameters for the next hyperparameter tuning cycle to determine the second neural network for the next hyperparameter tuning cycle. The first set of the current hyperparameter tuning cycle includes the hyperparameters of the current hyperparameter tuning cycle and the hyperparameters of the historical hyperparameter tuning cycles. The second set of the current hyperparameter tuning cycle includes the verification results of the second neural network of the current hyperparameter tuning cycle and the verification results of the second neural network of the historical hyperparameter tuning cycles. Based on the first set and the second set of the last hyperparameter tuning cycle, and the second neural network of multiple hyperparameter tuning cycles, a third neural network and an optimized hyperparameter set are determined, wherein the number of hyperparameters in the optimized hyperparameter set is less than the number of hyperparameters in the current hyperparameter set; Based on the third neural network and the optimized hyperparameter set, the structure of the third neural network is optimized by the optimized hyperparameter set to obtain the target neural network, which is used to perform any one of the following tasks: text recognition, audio processing, image processing, and video processing. The step of determining the third neural network and the optimized hyperparameter set based on the first set and the second set of the last hyperparameter adjustment cycle, and the second neural network of multiple hyperparameter adjustment cycles, specifically includes: determining the target hyperparameter in the first set of the last hyperparameter adjustment cycle based on the second set of the last hyperparameter adjustment cycle; and determining the second neural network of the hyperparameter adjustment cycle corresponding to the target hyperparameter as the third neural network. The process involves iterating through multiple cycles of hyperparameter optimization and multiple cycles of neural network architecture search to determine the hyperparameters and neural network architecture, where each architecture tuning cycle includes multiple hyperparameter tuning cycles.
2. The method of claim 1, wherein, The method further includes: Randomly sample network blocks at each network layer of the second neural network to determine the first network block from each network layer; The second sub-network is determined based on the first network block of each network level; The training samples with labeled information are processed by the second sub-network to determine the first processing result of the second sub-network. Based on the first processing result and the annotation information, the accuracy of the second sub-network is determined; The verification result of the second neural network is determined based on the accuracy of multiple second sub-networks.
3. The method of claim 2, wherein, The verification results include the average accuracy of multiple second sub-networks.
4. The method of claim 1, wherein, Based on the first and second sets of hyperparameters from the last hyperparameter tuning cycle, and the second neural network across multiple hyperparameter tuning cycles, the third neural network and the optimized hyperparameter set are determined, including: Based on the second set of the last hyperparameter adjustment cycle or the target hyperparameter, the hyperparameter set of the current structural adjustment cycle is reduced to obtain the optimized hyperparameter set.
5. The method of claim 4, wherein, Based on the second set of the last hyperparameter adjustment cycle or the target hyperparameters, the hyperparameter set of the current structure adjustment cycle is reduced to obtain the optimized hyperparameter set, including: When the hyperparameter is a continuous variable, retain the hyperparameters within a preset neighborhood centered on the target hyperparameter and remove the hyperparameters outside the preset neighborhood.
6. The method of claim 4, wherein, Based on the second set of the last hyperparameter adjustment cycle or the target hyperparameters, the hyperparameter set of the current structure adjustment cycle is reduced to obtain the optimized hyperparameter set, including: When the hyperparameters are discrete variables, the first hyperparameter is removed, where the verification result of the second neural network corresponding to the first hyperparameter does not meet the accuracy condition.
7. The method of claim 1, wherein, The structural tuning cycle includes multiple hyperparameter tuning cycles. The current hyperparameter set is the hyperparameter set for the current structural tuning cycle, and the optimized hyperparameter set is the hyperparameter set for the next hyperparameter tuning cycle. The current first neural network is the first neural network for the current structural tuning cycle. Based on the third neural network and the optimized hyperparameter set, the target neural network is obtained, including: Based on the verification results of the third neural network, the first neural network for the next structural adjustment cycle is determined, wherein the number of network blocks in each network layer of the first neural network for the next structural adjustment cycle is less than the number of network blocks in each network layer of the first neural network for the current structural adjustment cycle. The target neural network is obtained based on the network of the first neural network in the next structural adjustment cycle and the hyperparameter set of the next structural adjustment cycle. The target neural network is the first neural network whose structure meets the structural conditions.
8. The method of claim 7, wherein, The verification result of the third neural network includes the verification results of multiple third sub-networks. The third sub-network includes randomly selected network blocks from multiple network blocks at each network layer of the third neural network. The first neural network for the next structural adjustment cycle is determined based on the verification results of the third neural network, including: Based on the verification results of multiple third sub-networks, a fourth sub-network that does not meet the preset accuracy requirement is identified among the multiple third sub-networks; The network blocks included in each network layer of the preset number of fourth sub-networks are statistically analyzed to determine the second network block in each network layer of the preset number of fourth sub-networks, wherein the second network block is the network block that meets the quantity requirement among the network blocks in each network layer of the preset number of fourth sub-networks; In the third neural network, the second network block is removed to obtain the first neural network for the next structural adjustment cycle.
9. The method of claim 8, wherein, The plurality of third sub-networks include sub-networks obtained by randomly sampling multiple network blocks of each network layer of the second neural network corresponding to the third neural network when determining the verification result in the second set, and sub-networks obtained by randomly sampling multiple network blocks of each network layer of the third neural network after determining the third neural network.
10. The method of claim 1, wherein, The method further includes: The target neural network is trained by randomly selecting hyperparameters from the set of hyperparameters of the structural adjustment period corresponding to the target neural network, and training samples with labeled information, to obtain the trained target neural network.
11. A neural network structure determination apparatus characterized by comprising: include: The first training module is used to train the first sub-network of the current first neural network according to the hyperparameters of the first hyperparameter adjustment period to obtain the second neural network of the first hyperparameter adjustment period. The first neural network includes multiple network layers, each network layer includes multiple network blocks, and the first sub-network includes network blocks randomly selected from the multiple network blocks of each network layer of the first neural network. The hyperparameters of the first hyperparameter adjustment period are selected from the current hyperparameter set. The hyperparameter tuning module is used to perform hyperparameter tuning processing based on a first set of current hyperparameter tuning cycles and a second set of current hyperparameter tuning cycles, determine the hyperparameters for the next hyperparameter tuning cycle from the current hyperparameter set, train the first sub-network based on the hyperparameters for the next hyperparameter tuning cycle, and determine the second neural network for the next hyperparameter tuning cycle. The first set of current hyperparameter tuning cycles includes the hyperparameters for the current hyperparameter tuning cycle and the hyperparameters for historical hyperparameter tuning cycles. The second set of current hyperparameter tuning cycles includes the verification results of the second neural network for the current hyperparameter tuning cycle and the verification results of the second neural network for historical hyperparameter tuning cycles. The first optimization module is used to determine the third neural network and the optimized hyperparameter set based on the first set and the second set of the last hyperparameter adjustment cycle and the second neural network of multiple hyperparameter adjustment cycles, wherein the number of hyperparameters in the optimized hyperparameter set is less than the number of hyperparameters in the current hyperparameter set. The first obtaining module is used to optimize the structure of the third neural network based on the third neural network and the optimized hyperparameter set to obtain a target neural network, which is used to perform any one of text recognition task, audio processing task, image processing task, and video processing task. The first optimization module is further configured to: determine the target hyperparameter in the first set of the last hyperparameter adjustment cycle based on the second set of the last hyperparameter adjustment cycle; and determine the second neural network of the hyperparameter adjustment cycle corresponding to the target hyperparameter as the third neural network; The device iterates through multiple cycles of hyperparameter optimization and multiple cycles of neural network structure search to determine the hyperparameters and neural network structure, wherein each structure adjustment cycle includes multiple hyperparameter adjustment cycles.
12. An electronic device, comprising: include: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to invoke the instructions stored by the memory to perform the method of any one of claims 1 to 10.
13. A computer-readable storage medium having stored thereon computer program instructions, wherein, The computer program instructions, when executed by a processor, implement the method of any one of claims 1 to 10.