Method, apparatus, electronic device and computer readable medium for network acquisition
Patent Information
- Application Number
- CN202210138688.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-15
- Publication Date
- 2026-09-11
- Estimated Expiration
- 2042-02-15
AI Technical Summary
然而,目前对超网络的训练方法效果较差,不够理想
[0008]Fifthly, embodiments of this application also provide a computer program product, including a computer program/instructions that, when executed by a processor, implement the above-described method.
Smart Images

Figure CN116663624B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and more specifically, to a method, apparatus, electronic device, and computer-readable medium for network acquisition. Background Technology
[0002] Currently, deep neural networks have achieved significant results in many fields, and the structure of deep neural network models directly affects their performance. To efficiently select the optimal model structure to suit different task requirements, a supernetwork containing all possible model structures can be pre-constructed, trained, and then, in actual deep learning tasks, a suitable subnetwork can be searched from the supernetwork to serve as the neural network model for that task. However, current methods for training supernetworks are not very effective and fall short of expectations. Summary of the Invention
[0003] This application discloses a method, apparatus, electronic device, and computer-readable medium for network acquisition.
[0004] In a first aspect, embodiments of this application provide a method for network acquisition, applied to an electronic device. The method includes: acquiring an initial supernetwork, the initial supernetwork including at least one subnetwork; searching for a target subnetwork from the at least one subnetwork whose computing power meets specified computing requirements; and training the target subnetwork based on pre-acquired training data to update the initial supernetwork.
[0005] Secondly, embodiments of this application also provide a network acquisition apparatus applied to an electronic device, the apparatus comprising: an acquisition unit, a search unit, and a training unit. The acquisition unit is used to acquire an initial supernetwork, the initial supernetwork including at least one subnetwork; the search unit is used to search for a target subnetwork from the at least one subnetwork whose computing power meets specified computing requirements; and the training unit is used to train the target subnetwork based on pre-acquired training data to update the initial supernetwork.
[0006] Thirdly, embodiments of this application also provide an electronic device, including: one or more processors; a memory; one or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the one or more processors, and the one or more application programs are configured to perform the methods described above.
[0007] Fourthly, embodiments of this application also provide a computer-readable medium storing processor-executable program code, which, when executed by the processor, causes the processor to perform the above-described method.
[0008] Fifthly, embodiments of this application also provide a computer program product, including a computer program / instructions that, when executed by a processor, implement the above-described method.
[0009] The network acquisition method, apparatus, electronic device, and computer-readable medium provided in this application first acquire an initial supernetwork, then search for a target subnetwork whose computing power meets specified computational requirements from at least one subnetwork included in the supernetwork, and train the target subnetwork based on pre-acquired training data to update the initial supernetwork. If subnetworks are randomly searched for for training, easily sampled subnetworks can receive sufficient training, while less easily sampled subnetworks cannot, resulting in overly dispersed training subnetworks. This application, by finding and training target subnetworks whose computing power meets specified computational requirements, can exclude the training of subnetworks with poor computing power, ensuring that the trained subnetworks are clustered under given constraints, improving training efficiency, and avoiding excessive dispersion of subnetworks.
[0010] Other features and advantages of the embodiments of this application will be set forth in the following description, and will be apparent in part from the description, or may be learned by practicing the embodiments of this application. The objects and other advantages of the embodiments of this application may be realized and obtained by means of the structures particularly pointed out in the written description, claims, and drawings. Attached Figure Description
[0011] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0012] Figure 1 The statistical distribution of subnets during the training process of the hypernetwork is shown;
[0013] Figure 2 The diagram illustrates a scenario in which the network acquisition method provided in this application embodiment is applied.
[0014] Figure 3 A flowchart of a network acquisition method provided in an embodiment of this application is shown;
[0015] Figure 4 A flowchart of a network acquisition method according to another embodiment of this application is shown;
[0016] Figure 5 A flowchart of a network acquisition method according to another embodiment of this application is shown;
[0017] Figure 6 A flowchart of a network acquisition method according to another embodiment of this application is shown;
[0018] Figure 7 A flowchart of a network acquisition method according to another embodiment of this application is shown;
[0019] Figure 8 A unit block diagram of the network acquisition apparatus provided in an embodiment of this application is shown;
[0020] Figure 9 A schematic diagram of an electronic device provided in an embodiment of this application is shown;
[0021] Figure 10 This paper shows a structural block diagram of a computer-readable storage medium provided in an embodiment of this application;
[0022] Figure 11 A structural block diagram of a computer program product provided in an embodiment of this application is shown. Detailed Implementation
[0023] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present application, and not all of them. The components of the embodiments of the present application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely represents selected embodiments of the present application. All other embodiments obtained by those skilled in the art based on the embodiments of the present application without inventive effort are within the scope of protection of the present application.
[0024] It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. Furthermore, in the description of this application, terms such as "first," "second," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0025] Currently, deep neural networks have achieved significant results in many fields, and the structure of a deep neural network model directly affects its performance. Traditional neural network models are designed by experts based on experience, requiring extensive expert knowledge and resulting in high design costs. Now, Neural Architecture Search (NAS) is commonly used to replace tedious manual operations with algorithms, automatically searching for the optimal neural network architecture.
[0026] Specifically, a supernetwork containing all possible model structures can be pre-built, trained, and then, in the actual deep learning task, a suitable subnetwork can be searched from the supernetwork as the neural network model to perform the deep learning task.
[0027] However, the inventors discovered in their research that training by randomly searching for subnetworks using current methods easily leads to overly scattered sampled subnetworks. Furthermore, subnetworks that are easily sampled receive more thorough training, while those that are less easily sampled do not, resulting in insufficient training of some regions and unsatisfactory performance of the trained supernetwork. For example, please refer to... Figure 1 , Figure 1 The x-axis represents the number of floating-point operations (FLOPs), which characterizes the complexity of a sub-network model. The y-axis represents the quantity, which characterizes the number of times a sub-network is sampled. It can be seen that sub-networks with FLOPs distributed between 40G and 60G have a high probability of being sampled, while those in other regions have a low probability of being sampled, leading to insufficient training of these sub-networks. Here, G stands for gigabyte, i.e., 1 GFLOPs = 10^66 FLOPs. 9 FLOPs.
[0028] Therefore, to overcome the above-mentioned shortcomings, this application provides a method, apparatus, electronic device, and computer-readable medium for network acquisition. The method first acquires an initial supernetwork, then searches for a target subnetwork whose computational capabilities meet specified computational requirements from at least one subnetwork included in the supernetwork, and trains the target subnetwork based on pre-acquired training data to update the initial supernetwork. Randomly searching for subnetworks for training can easily lead to overly dispersed sampled subnetworks. Furthermore, easily sampled subnetworks can receive sufficient training, while less easily sampled subnetworks cannot, resulting in insufficient training in some areas. This application, by finding and training a target subnetwork whose computational capabilities meet specified computational requirements, enables the target subnetwork to receive more sufficient training and ensures that the trained subnetworks are clustered as much as possible under given constraints, avoiding excessive dispersion of subnetworks.
[0029] Please see Figure 2 , Figure 2 The present application scenario of the network acquisition method provided in the embodiments of this application is shown, namely network acquisition scenario 200, wherein the network acquisition scenario 200 includes an electronic device 210 and the Internet 220, and the electronic device 200 can be connected to the Internet 220.
[0030] In some implementations, the electronic device 210 can connect to the Internet 220 via a wired or wireless connection to receive or send messages, etc. For example, the electronic device 210 can send deep learning task requests related to tasks such as voice interaction, text classification, image recognition, and key point detection to the Internet 220. The electronic device 220 can be equipped with applications that perform different functions, such as image processing applications, information analysis applications, and voice assistant applications. Wired connections can also include accessing the Internet 220 via a network cable or fiber optic cable; wireless connections can also include connecting to the Internet 220 via wireless communication technologies such as Wi-Fi, ZigBee, and Bluetooth. Specifically, the electronic device 210 can be a smartphone, tablet computer, in-vehicle computer, laptop computer, desktop computer, etc.
[0031] Furthermore, the electronic device 210 can pre-acquire deep learning task data to construct training samples and use these training samples to train a neural network for implementing the aforementioned services. Upon receiving a task request, the electronic device 210 can automatically search for and optimize the model structure of the neural network. Specifically, the electronic device 210 can achieve automatic search for the model structure of the neural network through a hypernetwork.
[0032] Furthermore, the electronic device 210 can acquire training samples via the Internet 220 and then train the hypernetwork locally. Upon receiving a task request, it can directly access and use the trained hypernetwork. It can also access and use hypernetworks trained on other electronic devices that are also connected to the Internet 220 upon receiving a task request. Specifically, these other electronic devices can be servers running various services, such as servers running image-based target tracking services or voice-based speech processing services.
[0033] It should be noted that the electronic device 210 used to implement the network acquisition method provided in the embodiments of this application can be one or more, including but not limited to the specific devices mentioned above, and can be flexibly configured according to actual needs, without limitation here.
[0034] Please see Figure 3 , Figure 3 This application illustrates a method for obtaining network access according to an embodiment of the present application. This method can be applied to the network access scenario 100 in the foregoing embodiments, and the executing entity of the method can be an electronic device. Specifically, the method includes steps S310 to S330.
[0035] Step S310: Obtain an initial supernetwork, which includes at least one subnetwork.
[0036] In some implementations, an initial supernetwork can be pre-obtained. This initial supernetwork can be constructed based on optional structural units of each layer of the neural network model. A complete neural network model can be constructed by sampling one connection in each layer. Here, the initial supernetwork refers to a network encompassing the entire search space, and may include multiple layers. Each layer may include multiple optional substructures, and each substructure may include one or more optional operators, such as convolution operators, pooling operators, etc. Furthermore, at least one substructure can be sampled from each layer of the search space to obtain a subnetwork. Therefore, the initial supernetwork includes at least one subnetwork. The sampling method for obtaining the subnetwork may include uniform sampling or independent sampling.
[0037] Furthermore, a subnetwork may include one or more substructures. For example, the initial supernetwork may include three layers: x, y, and z. Layer x may include substructures x1, x2, and x3; layer y may include substructures y1, y2, y3, and y4; and layer z may include substructures z1, z2, and z3. In this case, subnetwork 1 may include substructure x1; subnetwork 2 may include substructures x2, y1, and z1; and subnetwork 3 may include substructures x3 and y2. That is, subnetwork 1 includes one substructure, subnetwork 2 includes three substructures, and subnetwork 3 includes two substructures.
[0038] Step S320: From the at least one sub-network, find the target sub-network whose computing power meets the specified computing requirements.
[0039] In some implementations, subnetworks can be obtained from the aforementioned initial supernetwork, and trained using pre-acquired training data to update the initial supernetwork. Furthermore, the obtained subnetworks can be selected, with only those meeting the requirements being trained. This avoids training all obtained subnetworks each time, which could result in easily sampled subnetworks receiving sufficient training while less easily sampled subnetworks receive insufficient training, leading to inadequate training in some areas and an unsatisfactory supernetwork performance.
[0040] Specifically, in some implementations, a target can be set, and each subnetwork in the initial supernetwork can be obtained through traversal. Then, it can be determined whether each subnetwork meets the set target. If it does, the subnetwork is considered to meet the requirements. All subnetworks that meet the requirements are selected, and then trained using pre-acquired training data to update the initial supernetwork. See subsequent embodiments for details.
[0041] For some other embodiments, a target may also be set, any number of sub-networks are selected from the initial super-network, and it is determined whether the selected sub-networks satisfy the target. If it is determined that the target is satisfied, the sub-networks are trained with pre-acquired training data to update the initial super-network. Wherein, the any number of sub-networks may be one or several, and several is less than or equal to the maximum value of the number of sub-networks included in the super-network. For example, if the initial super-network includes 100 sub-networks, the selected any number of sub-networks may be an integer number between 1 and 100. Furthermore, the number of selected sub-networks can also be limited in the form of a ratio to avoid selecting too many sub-networks at one time. For example, a ratio of the maximum number of selectable sub-networks to the maximum number of sub-networks in the initial super-network can be set. For example, the ratio of the maximum number of selectable sub-networks to the maximum number of sub-networks in the initial super-network can be set as M, and M can be 1 / 10. When the initial super-network includes 100 sub-networks, 100×M=10, that is, the selected any number of sub-networks can be an integer number between 1 and 10. For details, please refer to the subsequent embodiments.
[0042] It is easy to understand that the obtained sub-networks can be judged whether they satisfy the target based on different set targets. For an embodiment provided in the present application, the computing power corresponding to a sub-network can be represented by the number of floating-point operations FLOPs, then the set target can be a specified computing requirement, and the specified computing requirement corresponds to a target computing power. At this time, the difference between the computing power of the sub-network and the target computing power can be obtained. If the difference is less than a specified threshold, it can be determined that the computing power of the sub-network satisfies the specified computing requirement. For an example, the target computing power can be set as M, the specified threshold as N, and if the obtained computing power of the sub-network is X, then the difference between the computing power of the sub-network and the target computing power can be represented by |M-X|. Wherein, "||" is an absolute value symbol. Since the target computing power M can be greater than the specified threshold N or less than the specified threshold N, it is only necessary to judge the difference, so taking the absolute value is sufficient. At this time, the magnitude relationship between |M-X| and N can be judged. If |M-X|<N, the difference is less than the specified threshold, and it can be determined that the computing power of the sub-network satisfies the specified computing requirement. For example, if the obtained computing power of the sub-network is 10 GFLOPs, the target computing power M is 10.5 GFLOPs, and the specified threshold N is 1 GFLOPs, then |10 GFLOPs - 10.5 GFLOPs| < 1 GFLOPs, it can be determined that the computing power of the sub-network satisfies the specified computing requirement, that is, the sub-network can be used as the target sub-network.
[0043] Further, there may be more than one target computing power set above. In this case, the computing power corresponding to the sub-network is obtained, and by calculating the difference between the computing power and each set target computing power, it is determined whether each difference satisfies a specified threshold. If at least one difference satisfies the specified threshold, it can be determined that the computing power of the sub-network meets the specified computing requirement. By way of example, the target computing power may be set as M1, M2, M3 and M4, and the specified threshold is N. If the obtained computing power of the sub-network is X, the differences between the computing power of the sub-network and the target computing power can be represented by |M1-X|, |M2-X|, |M3-X| and |M4-X|. Herein, the reason for using the absolute value is the same as that introduced above, and will not be repeated here. Then the magnitude relationship between |M1-X|, |M2-X|, |M3-X|, |M4-X| and N can be determined separately. If any one of |M1-X|<N, |M2-X|<N, |M3-X|<N and |M4-X|<N is satisfied, it can be determined that the difference is less than the specified threshold, and it can be determined that the computing power of the sub-network meets the specified computing requirement. For example, if the obtained computing power of the sub-network is 10GFLOPs, the target computing power M1 is 10.5GFLOPs, M2 is 30GFLOPs, M3 is 50GFLOPs, M4 is 70GFLOPs, and the specified threshold N is 1GFLOPs, then |10GFLOPs-10.5GFLOPs|<1GFLOPs is satisfied, it can be determined that the computing power of the sub-network meets the specified computing requirement, that is, the sub-network can be used as the target sub-network.
[0044] Specifically, for an implementation manner provided by the present application, four FLOPs values can be determined according to the FLOPs distribution of sub-networks in the super-network, and there are many sub-networks near these four FLOPs values. Specifically, the four values are 19396673536GFLOPs, 35339173888GFLOPs, 59391655936GFLOPs, and 94138007552GFLOPs respectively.
[0045] Step S330: training the target sub-network based on pre-obtained training data, so as to update the initial super-network.
[0046] In some implementations, the target sub-network can be trained based on pre-acquired training data to update the initial super-network. Specifically, the training data can be image data, text data, audio data, or video data. It is readily understood that the training data should correspond to the specific task processed by the sub-network. For example, if the specific task processed by the sub-network is related to natural language processing, the corresponding training data can be image data and text data. This training data can be pre-acquired from the internet via an electronic device and stored in the storage device of that electronic device, and then retrieved directly from the local storage during training. Alternatively, training data can be directly obtained from a dedicated database via the internet, and retrieved from the database during training.
[0047] Furthermore, since the initial supernetwork includes subnetworks and their corresponding substructures, changes in the parameters of each subnetwork structure obtained after training will also synchronously update the corresponding subnetworks and their substructures in the initial supernetwork. For example, if subnetwork 1 obtained from the initial supernetwork meets the specified computational requirements, and subnetwork 1 includes substructures x1, y1, and z1, after training this subnetwork with pre-acquired training data, substructure x1 may have updated its parameters, while substructures y1 and z1 remain unchanged. In this case, substructure x1 included in the initial supernetwork will be updated synchronously.
[0048] The method, apparatus, electronic device, and computer-readable medium for network acquisition provided in this application first acquire an initial supernetwork. Then, from at least one subnetwork included in the supernetwork, a target subnetwork whose computational power meets specified computational requirements is identified. The target subnetwork is then trained based on pre-acquired training data to update the initial supernetwork. If subnetworks are trained by random search, easily sampled subnetworks will receive sufficient training, while less easily sampled subnetworks will not, resulting in overly dispersed training subnetworks. This application, by identifying and training a target subnetwork whose computational power meets specified computational requirements, can exclude the training of irrelevant subnetworks, ensuring that the trained subnetworks are clustered within the given constraints, thus improving training efficiency and preventing excessive dispersion of subnetworks.
[0049] Please see Figure 4 , Figure 4 This application illustrates a method for obtaining network access according to an embodiment of the present application. This method can be applied to the network access scenario 100 in the foregoing embodiments, and the executing entity of the method can be an electronic device. Specifically, the method includes steps S410 to S450.
[0050] Step S410: Obtain an initial supernetwork, which includes at least one subnetwork.
[0051] Step S410 has been described in detail in the foregoing embodiments and will not be repeated here.
[0052] Step S420: From the at least one sub-network, find all sub-networks whose computing power meets the specified computing requirements, and select them as target sub-networks.
[0053] In some implementations, a target can be set, and each subnetwork in the initial supernetwork can be obtained through traversal. Then, it can be determined whether each subnetwork meets the target. If it does, the subnetwork is considered to meet the requirements. All subnetworks that meet the requirements are selected, and then trained using pre-acquired training data to update the initial supernetwork.
[0054] One exemplary approach is to number each subnetwork in the initial supernetwork sequentially, starting from 1. Then, each subnetwork is retrieved in ascending order of its number until all numbered subnetworks have been retrieved. Each retrieved subnetwork is then checked against the set target in ascending order of its number. Subnetworks that meet the target are marked. After traversing all subnetworks, a complete set of subnetworks satisfying the target, consisting of the marked subnetworks, is obtained.
[0055] Specifically, in one embodiment provided in this application, the computing power corresponding to a sub-network can be represented by the number of floating-point operations (FLOPs). The set target can be a specified computing requirement, which corresponds to a target computing power. For each obtained sub-network, the computing power of the sub-network can be determined using the method described in the preceding embodiments to meet the target computing power; this will not be elaborated further here. Using the above method, all sub-networks in the initial supernetwork that meet the target computing power can be obtained, and the set of these sub-networks can be used as the target sub-network.
[0056] Step S430: Train the target sub-network based on the pre-acquired training data to update the initial supernetwork.
[0057] In some implementations, since the target subnetwork obtained in step S420 can be a set of several subnetworks that meet the specified computational requirements, a subnetwork can be selected from the target subnetwork for training during training. It can be selected randomly or sequentially, and there is no limitation here.
[0058] The method of training the target subnetwork with training data to update the initial supernetwork can be found in the description in the foregoing embodiments, and will not be repeated here.
[0059] Step S440: Determine whether the updated initial supernetwork meets the specified conditions.
[0060] Step S450: If not satisfied, return to training the target sub-network based on the pre-acquired training data to update the initial supernetwork until the updated initial supernetwork satisfies the specified conditions.
[0061] In some implementations, the updated initial supernetwork can be evaluated to determine whether it meets specified conditions. If it does, the training of the target subnetwork can be terminated, and the updated initial supernetwork can be used to perform the task. If it does not meet the conditions, the target subnetwork can be trained again based on the pre-acquired training data to update the initial supernetwork until the updated initial supernetwork meets the specified conditions.
[0062] One example is that the number of times the target sub-network has been trained can be obtained. When this number of times reaches a counting threshold, training of the target sub-network ends, and the updated initial supernetwork is used to perform the task. For example, the specified condition can be a technical threshold. If the technical threshold is 10,000, then when the number of times the target sub-network has been trained reaches 10,000, training of the target sub-network can end, and the updated initial supernetwork can be used to perform the task. When the number of times the target sub-network has been trained has not reached 10,000, training of the target sub-network based on pre-acquired training data can be resumed to update the initial supernetwork until the updated initial supernetwork meets the specified condition.
[0063] Optionally, as an example, the updated initial supernetwork can be evaluated by statistically analyzing the performance data of each subnetwork in the updated initial supernetwork. For instance, the specified condition can be an average threshold. The performance values of each subnetwork in the updated initial supernetwork can be statistically analyzed, and then the average performance value of all subnetworks can be calculated. If the average value is less than the average threshold, it can be determined that the updated initial supernetwork meets the specified condition. If the average value is greater than or equal to the average threshold, the target subnetwork can be trained based on pre-acquired training data to update the initial supernetwork until the updated initial supernetwork meets the specified condition.
[0064] Optionally, since the number of training iterations for the target subnetwork is typically large, often in the tens of thousands, judging whether the updated supernetwork meets the specified conditions after each training iteration would waste resources and reduce the overall system efficiency. Therefore, the two examples above can be combined. A counting threshold can be set. When the number of training iterations for the target subnetwork reaches this threshold, the updated initial supernetwork is evaluated using the performance data of each subnetwork within it. If the performance data does not meet the specified conditions, training of the target subnetwork can continue, and the number of training iterations can be reset to zero and the count restarted until the number of training iterations reaches the counting threshold. Then, the updated initial supernetwork is evaluated again using the performance data of each subnetwork within it. For example, a counting threshold of 10,000 times can be set. When the number of training iterations of the target sub-network reaches 10,000, the updated super-network is checked using the above method to see if it meets the specified conditions. If it does, the training of the target sub-network can be terminated, and the updated initial super-network can be used to perform the task. If it does not meet the conditions, the count of the number of training iterations of the target sub-network is reset to zero, and then the target sub-network is trained again based on the pre-acquired training data, while the number of training iterations is counted until the number of training iterations reaches 10,000, at which point the updated super-network is checked again to see if it meets the specified conditions.
[0065] Optionally, since the pre-acquired training data is generally large, a portion of the training data can be used for training in one iteration, and another portion can be used for training in the next iteration. Therefore, it can be determined whether the training data covers all the training data. If the training data covers all the training data, the performance data of each subnetwork in the updated initial supernetwork is then statistically analyzed to evaluate the updated initial supernetwork. If the performance data does not meet the specified conditions, training of the target subnetwork can continue, and the coverage of the training data can be recalculated. The performance data of each subnetwork in the updated initial supernetwork is then used to evaluate the updated initial supernetwork. This method is similar to the one described above and will not be elaborated further here.
[0066] Furthermore, in the implementation provided in this application, since all target subnetworks that meet the specified computational requirements have been identified from the initial supernetwork in step S420, when it is determined that the updated initial supernetwork does not meet the specified conditions, the target subnetworks that have been identified as meeting the specified computational requirements can be trained directly without having to determine again whether the currently acquired subnetwork meets the specified conditions.
[0067] Optionally, since the target subnetwork may include multiple subnetworks, one subnetwork may be selected for training each time. For example, it can be selected randomly or sequentially, without limitation here.
[0068] The network acquisition method, apparatus, electronic device, and computer-readable medium provided in this application first acquire an initial supernetwork. From at least one subnetwork included in the supernetwork, all subnetworks whose computational capabilities meet specified computational requirements are identified as target subnetworks. The target subnetworks are then trained based on pre-acquired training data to update the initial supernetwork. If the updated initial supernetwork is determined not to meet specified conditions, the process returns to training the target subnetworks based on the pre-acquired training data to update the initial supernetwork, until the updated initial supernetwork meets the specified conditions. If subnetworks are randomly searched for during training, easily sampled subnetworks may receive sufficient training, while less easily sampled subnetworks may not receive sufficient training, resulting in overly dispersed training of subnetworks. This application pre-obtains all target subnetworks in the initial supernetwork that meet the specified computational requirements by setting computational requirements, and then directly trains all target subnetworks that meet the specified computational requirements. This avoids judging whether the selected subnetwork meets the specified computational requirements after each subnetwork selection, thus optimizing the process. Then, by judging whether the updated initial supernetwork meets the specified conditions, training continues if it does not meet the conditions, so that the target subnetworks can be trained more fully and the trained subnetworks are clustered as much as possible under the given constraints, avoiding excessive dispersion of subnetworks.
[0069] Please see Figure 5 , Figure 5 This application illustrates a method for obtaining a network, which can be applied to the network acquisition scenario 100 described above. The method can be executed by an electronic device. Specifically, the method includes steps S510 to S550.
[0070] Step S510: Obtain an initial supernetwork, which includes at least one subnetwork.
[0071] Step S510 has been described in detail in the foregoing embodiments and will not be repeated here.
[0072] Step S520: From the at least one subnetwork, find any subnetwork whose computing power meets the specified computing requirements, and use it as the target subnetwork.
[0073] In some implementations, a target can be set. Each time a subnetwork is obtained from the initial supernetwork, it is determined whether the subnetwork meets the set target. If it meets the target, the subnetwork is deemed to be compliant and used as the target subnetwork for training. If it does not meet the target, the subnetwork is deemed to be ineligible, and the process returns to obtaining a new subnetwork from the initial supernetwork.
[0074] Specifically, in one embodiment provided in this application, the computing power corresponding to a sub-network can be represented by the number of floating-point operations (FLOPs). The set target can then be a specified computing requirement, which corresponds to a target computing power. For each acquired sub-network, the computing power of the sub-network can be determined using the method described in the preceding embodiments to meet the target computing power; this will not be elaborated upon here. Sub-networks that meet the specified computing requirements are selected as target sub-networks and participate in training.
[0075] Furthermore, in other implementations, more than one subnetwork can be searched to find one whose computing power meets the specified computing requirements. That is, more than one subnetwork can be selected from the initial supernetwork, for example, two subnetworks can be selected, and it can be determined whether each of the two selected subnetworks meets the specified computing requirements. The method for determination can be referred to the foregoing embodiments, and will not be repeated here.
[0076] Step S530: Train the target sub-network based on the pre-acquired training data to update the initial supernetwork.
[0077] In some implementations, if the target subnetwork obtained in step S520 includes only one subnetwork, the target subnetwork can be trained directly; if the target subnetwork includes more than one subnetwork, a subnetwork can be selected from the target subnetwork for training. The selection method can be random selection or selection of the subnetwork in the target subnetwork that is closest to the specified computational requirements. No limitation is made here.
[0078] Furthermore, the method for training the target subnetwork using training data to update the initial supernetwork can be found in the description in the foregoing embodiments, and will not be repeated here.
[0079] Step S540: Determine whether the updated initial supernetwork meets the specified conditions.
[0080] Step S550: If not satisfied, return to the process of finding any one of the at least one sub-networks whose computing power meets the specified computing requirements as the target sub-network, and training the target sub-network based on the pre-acquired training data to update the initial supernetwork until the updated initial supernetwork meets the specified conditions.
[0081] The method for determining whether the updated initial supernetwork meets the specified conditions can be found in the method described in the foregoing embodiments, and will not be repeated here.
[0082] If it is determined that the updated initial supernetwork does not meet the specified conditions, the process can return to obtaining the target subnetwork from the initial supernetwork, and then training the target subnetwork based on the pre-acquired training data to update the initial supernetwork, until the updated initial supernetwork meets the specified conditions.
[0083] The network acquisition method, apparatus, electronic device, and computer-readable medium provided in this application first acquire an initial supernetwork. From the at least one subnetwork, any subnetwork whose computational power meets specified computational requirements is selected as a target subnetwork. The target subnetwork is trained based on pre-acquired training data to update the initial supernetwork. If the updated initial supernetwork is determined not to meet specified conditions, the process returns to training the target subnetwork based on the pre-acquired training data to update the initial supernetwork, until the updated initial supernetwork meets the specified conditions. If subnetworks are randomly searched for for training, easily sampled subnetworks can receive sufficient training, while less easily sampled subnetworks cannot, resulting in overly scattered training of subnetworks. This application addresses the issue of insufficient training of subnetworks in certain regions by setting computational requirements and adding a step to determine whether the subnetwork meets the specified computational requirements each time a subnetwork is acquired. Training is only performed on target subnetworks that meet the computational requirements. Then, the updated initial supernetwork is judged to meet the specified conditions. If the conditions are not met, training continues. Without changing the existing method and process of training supernetworks, this application solves the problem of insufficient training of subnetworks in certain regions by adding a judgment step. This allows the target subnetwork to receive more sufficient training and makes the trained subnetworks as clustered as possible under the given constraints, avoiding excessive dispersion of subnetworks.
[0084] Please see Figure 6 , Figure 6 This application illustrates a method for obtaining network access according to an embodiment of the present application. This method can be applied to the network access scenario 100 in the foregoing embodiments, and the executing entity of the method can be an electronic device. Specifically, the method includes steps S610 to S690.
[0085] Step S610: Start iterating with iteration number = 1.
[0086] Step S620: Obtain a portion of the data based on the training data.
[0087] In some implementation methods, since the pre-acquired training data is generally large, a portion of the training data can be used for training in the current training session, while another portion can be used for training in the next training session.
[0088] Step S630: Obtain the sub-network.
[0089] The method for obtaining subnetworks from the initial supernetwork can be found in the foregoing embodiments, and will not be repeated here.
[0090] Step S640: Obtain the computing power of the sub-network.
[0091] Optionally, the computational power of a subnetwork can be represented by the number of floating-point operations (FLOPs).
[0092] Step S650: Does the specified operation requirement meet the requirements?
[0093] In one embodiment provided in this application, four specified computational requirements are set. When the computational capability of a sub-network meets any one of the specified computational requirements, it is determined that the specified computational requirement is met.
[0094] Step S660: Train the target subnetwork.
[0095] The target sub-network is trained based on a portion of the training data obtained in step S620.
[0096] Step S670: Whether to cover all training data.
[0097] In some implementations, it can be detected whether a portion of the data used in step S620 in this iteration covers all the training data. If it does not cover all the data, return to step S620; if it covers all the data, jump to step S680.
[0098] Step S680: Check if the number of iterations is less than the specified number.
[0099] In some implementations, a predetermined number of iterations can be set to limit the maximum number of iterations for training the initial supernetwork. It can be detected whether the current iteration number is less than the predetermined number. If it is less, the current iteration number is incremented by 1, and then the process jumps to step S620; if it is not less than the predetermined number, step S690 is executed.
[0100] Step S690: End.
[0101] Please see Figure 7 , Figure 7This application illustrates a method for obtaining a network, which can be applied to the network acquisition scenario 100 described above. The method can be executed by an electronic device. Specifically, the method includes steps S710 to S740.
[0102] Step S710: Obtain an initial supernetwork, which includes at least one subnetwork.
[0103] Step S720: From the at least one sub-network, find the target sub-network whose computing power meets the specified computing requirements.
[0104] Step S730: Train the target sub-network based on the pre-acquired training data to update the initial supernetwork.
[0105] Steps S710 to S730 have been described in detail in the foregoing embodiments and will not be repeated here.
[0106] Step S740: Obtain the target network based on the updated initial supernetwork, the target network being used to perform the target task.
[0107] In some implementations, the target task can be performed based on the updated initial supernetwork. It is readily understood that the number of subnetworks in the updated initial supernetwork that meet the given constraints can be reduced, thereby reducing the resources consumed in searching for suitable subnetworks. One exemplary constraint could be the number of floating-point operations (FLOPs). By specifying the FLOPs constraint, searching for subnetwork configurations that meet the conditions can yield the optimal subnetwork's substructure and the trained model. Another example is that the constraint could be the number of parameters in the subnetwork. It should be understood that the above constraints can be flexibly set as needed, and this application does not impose any limitations.
[0108] The network acquisition method, apparatus, electronic device, and computer-readable medium provided in this application can improve the performance of searching for and acquiring subnetworks by setting constraints when performing target tasks after acquiring the updated initial supernetwork, thereby improving the performance of edge deployment.
[0109] Please see Figure 8 , Figure 8 The diagram shows a structural diagram of a network acquisition device 800 provided in an embodiment of this application, which is applied to an electronic device. The device includes an acquisition unit 810, a search unit 820, and a training unit 830.
[0110] The acquisition unit 810 is used to acquire an initial supernetwork, which includes at least one subnetwork.
[0111] The search unit 820 is used to search for a target subnetwork whose computing power meets the specified computing requirements from the at least one subnetwork.
[0112] Furthermore, the search unit 820 is also used to search for all subnetworks whose computing power meets the specified computing requirements from the at least one subnetwork, as the target subnetwork.
[0113] Furthermore, the search unit 820 is also used to determine whether the updated initial supernetwork meets the specified conditions; if not, it returns to training the target subnetwork based on the pre-acquired training data to update the initial supernetwork until the updated initial supernetwork meets the specified conditions.
[0114] Furthermore, the search unit 820 is also used to search for any one of the at least one subnetworks whose computing power meets the specified computing requirements, as the target subnetwork.
[0115] Furthermore, the search unit 820 is also used to determine whether the updated initial supernetwork meets the specified conditions; if not, it returns to the process of searching for any subnetwork from the at least one subnetwork whose computing power meets the specified computing requirements as the target subnetwork, and training the target subnetwork based on the pre-acquired training data to update the initial supernetwork until the updated initial supernetwork meets the specified conditions.
[0116] Training unit 830 is used to train the target sub-network based on pre-acquired training data to update the initial supernetwork.
[0117] Furthermore, the network acquisition device 800 is also used to acquire a target network based on the updated initial supernetwork, the target network being used to perform the target task.
[0118] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the above-described apparatus and unit can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0119] In the several embodiments provided in this application, the coupling between the units can be electrical, mechanical or other forms of coupling.
[0120] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0121] Please refer to Figure 9 , Figure 9 This diagram illustrates a structural block diagram of an electronic device according to an embodiment of this application. The electronic device 900 can be a smartphone, tablet computer, server, or other electronic device capable of running applications. The electronic device 900 in this application may include one or more of the following components: a processor 910 and a memory 920, wherein the one or more processors are used to execute the methods described above.
[0122] The processor 910 may include one or more processing cores. The processor 910 connects to various parts within the electronic device 900 using various interfaces and lines, and performs various functions and processes data of the electronic device 900 by running or executing instructions, programs, code sets, or instruction sets stored in the memory 920, and by calling data stored in the memory 920. Optionally, the processor 910 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 910 may integrate one or a combination of several of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), Neural Network Processing Unit (NPU), and Modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the displayed content; the NPU can be used for neural network calculations; and the modem is used for wireless communication. It is understandable that the aforementioned modem may not be integrated into the processor 110, but may be implemented using a separate communication chip.
[0123] The memory 920 may include random access memory (RAM) or read-only memory (ROM). The memory 920 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 920 may include a program storage area and a data storage area. The program storage area may store instructions for implementing an operating system, instructions for implementing at least one function, instructions for implementing the various method embodiments described above, etc. The data storage area may also store data created by the electronic device 900 during use.
[0124] Please refer to Figure 10This diagram illustrates a structural block diagram of a computer-readable storage medium provided in an embodiment of this application. The computer-readable medium 1000 stores program code that can be called by a processor to execute the methods described in the above method embodiments.
[0125] The computer-readable storage medium 1000 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read-Only Memory), EPROM, hard disk, or ROM. Optionally, the computer-readable storage medium 1000 includes a non-transitory computer-readable storage medium. The computer-readable storage medium 1000 has storage space for program code 1010 that performs any of the method steps described above. This program code can be read from or written to one or more computer program products. The program code 1010 may be compressed, for example, in a suitable form.
[0126] Please refer to Figure 11 The diagram illustrates a structural block diagram 1100 of a computer program product provided in an embodiment of this application. The computer program product 1100 includes a computer program / instructions 1110, which, when executed by a processor, implements the steps of the aforementioned method.
[0127] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A method for network acquisition, characterized in that, Applied to end-side electronic devices, the method includes: Obtain an initial hypernetwork, which includes at least one subnetwork; From the at least one subnetwork, find the target subnetwork whose computing power meets the specified computing requirements corresponding to the constraints, wherein the constraints include at least one of the number of floating-point operations and the number of parameters in the subnetwork; The target sub-network is trained based on the pre-acquired training data to update the initial super-network, so that the target sub-networks in the updated initial super-network that satisfy the constraints are trained sufficiently and distributed in a concentrated manner. When the number of training iterations of the target subnetwork reaches the counting threshold, the updated initial supernetwork is evaluated using the performance data of each subnetwork in the updated initial supernetwork. If the performance data does not meet the specified conditions, continue training the target sub-network, and reset the number of training times for the target sub-network to zero and start counting again until the number of training times reaches the counting threshold. Then, evaluate the updated initial supernetwork using the performance data of each sub-network in the updated initial supernetwork. If the performance data meets the specified conditions, training of the target sub-network ends; Upon receiving a task request, the terminal electronic device locally acquires a target network based on the updated initial supernetwork, wherein the target network is used to perform a target task, the target network satisfies the constraints, and the task request includes a deep learning task such as voice interaction, text classification, image recognition, or key point detection.
2. The method according to claim 1, characterized in that, The step of finding a target subnetwork whose computing power meets the specified computing requirements from the at least one subnetwork includes: From the at least one subnetwork, find all subnetworks whose computing power meets the specified computing requirements, and select them as target subnetworks.
3. The method according to claim 1, characterized in that, The step of finding a target subnetwork whose computing power meets the specified computing requirements from the at least one subnetwork includes: From the at least one subnetwork, find any subnetwork whose computing power meets the specified computing requirements, and use it as the target subnetwork.
4. The method according to claim 3, characterized in that, After training the target subnetwork based on pre-acquired training data to update the initial supernetwork, the method further includes: Determine whether the updated initial hypernetwork meets the specified conditions; If the conditions are not met, the process returns to finding any one of the at least one subnetworks whose computational capabilities meet the specified computational requirements, and using it as the target subnetwork. The target subnetwork is then trained based on the pre-acquired training data to update the initial supernetwork until the updated initial supernetwork meets the specified conditions.
5. The method according to claim 1, characterized in that, The specified computational requirements correspond to a target computing power. The computing power of the sub-network meets the specified computational requirements if the difference between the computing power of the sub-network and the target computing power is less than a specified threshold.
6. A network acquisition device, characterized in that, The device is applied to end-side electronic devices and includes: An acquisition unit is used to acquire an initial supernetwork, wherein the initial supernetwork includes at least one subnetwork; The search unit is used to search for a target subnetwork whose computing power meets the specified computing requirements corresponding to the constraints from the at least one subnetwork, wherein the constraints include at least one of the number of floating-point operations and the number of parameters in the subnetwork; A training unit is used to train the target sub-network based on pre-acquired training data to update the initial super-network, ensuring that the target sub-networks in the updated initial super-network that satisfy the constraints are sufficiently trained and centrally distributed. When the number of training iterations for the target sub-network reaches a counting threshold, the updated initial super-network is evaluated using the performance data of each sub-network in the updated initial super-network. If the performance data does not meet the specified conditions, training of the target sub-network continues, and the number of training iterations is reset to zero and recounted until the number of training iterations reaches the counting threshold. The updated initial super-network is then evaluated again using the performance data of each sub-network in the updated initial super-network. If the performance data meets the specified conditions, training of the target sub-network ends. Upon receiving a task request, the target network is locally acquired on the terminal electronic device based on the updated initial super-network. The target network is used to perform a target task, and the target network satisfies the constraints. The task request includes deep learning tasks such as voice interaction, text classification, image recognition, or keypoint detection.
7. An electronic device, characterized in that, include: One or more processors; Memory; One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, the one or more applications being configured to perform the method as described in any one of claims 1-5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium contains program code that can be invoked by a processor to execute the method as described in any one of claims 1-5.
9. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instructions are executed by the processor, they implement the method described in any one of claims 1-5.
Citation Information
Patent Citations
Neural network structure searching method, image processing method and device
CN112445823A
Super network training method and device, electronic equipment and storage medium
CN112784961A