A method for acquiring neural networks, a data processing method, and related equipment.
By using the indication information in the Dirichlet distribution space to indicate only the probability and number of neural network modules, the problem of high resource and time consumption in the NAS process is solved, and high-performance neural networks are generated efficiently.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-30
- Publication Date
- 2026-03-13
AI Technical Summary
In the existing automatic neural network architecture search (NAS) process, generating a high-performance neural network requires a lot of computing resources and time, mainly because the search space is huge and it is necessary to select appropriate neural network modules and their topological relationships.
By acquiring indication information in the Dirichlet distribution space, only the probability and/or frequency of neural network modules in the neural architecture unit are indicated, without indicating the topological relationship between modules, thus narrowing the search space and reducing computational resources and time costs.
It significantly reduces the computer resources and time costs of the neural network acquisition process, while improving the efficiency and flexibility of generating high-performance neural networks.
Smart Images

Figure CN113869496B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence, and in particular to a method for acquiring neural networks, a data processing method, and related equipment. Background Technology
[0002] Artificial intelligence (AI) is the theory, methods, technology, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, AI is a branch of computer science that attempts to understand the essence of intelligence and produce a new kind of intelligent machine that can react in a way similar to human intelligence. AI studies the design principles and implementation methods of various intelligent machines, enabling them to possess the functions of perception, reasoning, and decision-making.
[0003] However, currently used neural networks are still manually designed by human experts based on experience. Automated Neural Architecture Search (NAS) is an important step towards automated machine learning (AutoML). Specifically, a neural network includes at least one neural architecture unit. NAS automatically generates these neural architecture units, thereby generating the neural network. Training operations are then performed on the neural network to obtain a performance score for the first neural network when processing the target data. The goal of NAS is to automatically obtain a high-performing neural network.
[0004] However, when using NAS to automatically generate neural architecture units, it is necessary not only to select suitable neural network modules to form the neural architecture units, but also to select the topological relationships between different neural network modules. This results in a huge search space for the neural architecture units, which means that the entire process of automatically obtaining high-performance neural networks consumes a lot of computer resources and has a high time cost. Summary of the Invention
[0005] This application provides a method for acquiring a neural network, a data processing method, and related devices. The method acquires second indication information from at least one first indication information, and then acquires the target neural network corresponding to the second indication information. The first indication information is only used to indicate the probability and / or frequency of each neural network module in the neural architecture unit, and is no longer used to indicate the topological relationship between different neural network modules. This greatly reduces the search space corresponding to the neural architecture unit, reduces the computer resources required for the entire neural network acquisition process, and saves time costs.
[0006] To address the aforementioned technical problems, this application provides the following technical solutions:
[0007] In a first aspect, embodiments of this application provide a method for obtaining a neural network, which can be used in the field of NAS (Neural Network Architecture) technology within the field of artificial intelligence. The method may include: a network device acquiring first indication information corresponding to a first neural architecture unit, the first neural architecture unit comprising N neural network modules, the first indication information indicating the probability and / or frequency of each of k candidate neural network modules appearing in the first neural architecture unit, where k is a positive integer; the network device generating a first neural architecture unit based on the first indication information, a first rule, and the k candidate neural network modules, and generating a first neural network based on the generated first neural architecture unit and a second rule, the first neural network comprising at least one first neural architecture unit, wherein the first rule indicates which N positions in the first neural architecture unit lack neural network modules; and the second rule indicates which C positions in the first neural network lack first neural architecture units; the network device acquiring a target score corresponding to the first indication information, the target score indicating the performance of the first neural network corresponding to the first indication information in processing target data; and acquiring a second indication information from the multiple first indication information based on multiple target scores corresponding to multiple first indication information, and determining a first neural network corresponding to the aforementioned second indication information as the target neural network.
[0008] In this implementation, researchers have discovered that if multiple different neural architecture units possess the same neural network modules, but the topological relationships corresponding to these modules are different, the performance of these multiple different neural architecture units in processing target data is often very similar. Therefore, this solution obtains second indication information from at least one first indication information, and then obtains the target neural network corresponding to the second indication information. The first indication information is only used to indicate the probability and / or frequency of each neural network module appearing in the neural architecture unit among the k neural network modules, and is no longer used to indicate the topological relationships between different neural network modules. This greatly reduces the search space corresponding to the neural architecture unit, reduces the computer resources required for the entire neural network acquisition process, and saves time costs.
[0009] In one possible implementation of the first aspect, the first indication information is included in a k-dimensional Dirichlet distribution space. The k-dimensional Dirichlet distribution space contains multiple vectors, each of which includes k elements. The aforementioned k elements are all non-negative real numbers, and the sum of the aforementioned k elements is 1. That is, in this implementation, the first indication information is used to indicate the probability of each neural network module appearing in the neural architecture unit among the k neural network modules.
[0010] In this embodiment of the application, since the sum of the k elements in each vector is 1 in the Dirichlet distribution space, and the Dirichlet distribution space is a uniformly distributed space, the first indication information can be easily collected based on the Dirichlet distribution principle, which reduces the difficulty of obtaining the first indication information in this solution.
[0011] In one possible implementation of the first aspect, after the network device obtains the target score corresponding to the first indication information, the method further includes: the network device obtaining new first indication information based on at least one old first indication information and the target score corresponding one-to-one with each old first indication information, wherein the new first indication information is used to indicate the probability of each of the k candidate neural network modules appearing in the first neural architecture unit, and the new first indication information is used to generate a new first neural network. Further, the network device can determine a first indication information (hereinafter referred to as "target indication information") corresponding to the highest target score from at least one old first indication information based on at least one old first indication information and the target score corresponding one-to-one with each old first indication information, and generate new first indication information based on the target indication information.
[0012] In this embodiment, since the target score corresponding to the old first indication information is higher, it proves that the old first neural network performs better when processing target data. The new first indication information is obtained based on the target score corresponding to each old first indication information, and the new first indication information is used to generate a new first neural network, which is beneficial to obtaining a new first neural network with good performance. Since each first indication information is sampled from the complete Dirichlet distribution space, overfitting to the local space is avoided in the sampling process of the first indication information. This ensures the openness of the sampling process of the first indication information and ensures that the new first neural network is optimized towards a better neural network architecture.
[0013] In one possible implementation of the first aspect, the first indication information includes k first probability values corresponding to k candidate neural network modules, each first probability value indicating the probability of a candidate neural network module appearing in the first neural architecture unit. The network device generates the first neural architecture unit based on the first indication information and the k candidate neural network modules, including: multiplying each first probability value by N to obtain a target result, the target result including k first values; rounding each first value in the target result to obtain a rounded target result, wherein the rounded target result includes k second values, all of which are integers and the sum of the k second values is N, each second value indicating the number of times a candidate neural network module appears in the first neural architecture unit; optionally, the rounded target result is closest to and most effective in relation to the target result; the aforementioned distance can be Euclidean distance, cosine distance, L1 distance, Mahalanobis distance, or other types of distance. The network device generates a first neural architecture unit based on the rounded target result and k candidate neural network modules. The first neural architecture unit includes N neural network modules that satisfy the constraints of the rounded target result, where N is a positive integer.
[0014] In this embodiment, since the first indication information is sampled from the Dirichlet distribution space, it can only guarantee that the sum of the k first probability values is 1, and cannot guarantee that the product of each first probability value and N is an integer. Therefore, each first value in the target result can be rounded to obtain the rounded target result. The rounded target result includes k second values, all of which are integers and the sum of the k second values is N. Each second value is used to indicate the number of times a neural network module appears in the neural architecture unit. Based on the rounded target result, the first neural architecture unit is constructed, thereby ensuring the smoothness of the construction process of the first neural architecture unit.
[0015] In one possible implementation of the first aspect, the network device generates a first neural architecture unit based on first indication information and k candidate neural network modules, including: the network device samples N first neural network modules based on the k candidate neural network modules according to the first indication information, the first indication information being used to indicate the probability of each candidate neural network module being sampled; and generates a first neural architecture unit based on the N first neural network modules, the first neural architecture unit including the N first neural network modules.
[0016] In this embodiment, N first neural network modules are sampled directly from k neural network modules based on the first instruction information, and then a first neural architecture unit is generated based on the sampled N first neural network modules. This provides another specific implementation method for generating a first neural architecture unit based on the first instruction information, which improves the implementation flexibility of this solution and is simple to operate and easy to implement.
[0017] In one possible implementation of the first aspect, the target data is any of the following: image, speech, text, or sequence data. The function of the target neural network is any of the following: image classification, object detection in an image, image transfer, text translation, speech recognition, regression of sequence data, or other functions. In this application embodiment, various specific application scenarios of the target neural network are provided, greatly expanding the implementation flexibility of this solution.
[0018] Secondly, embodiments of this application provide a method for obtaining a neural network, which can be used in the field of NAS (Neural Network Architecture) technology in the field of artificial intelligence. The method may include: a network device acquiring first indication information corresponding to a second neural architecture unit, the second neural architecture unit comprising N second neural network modules, each second neural network module being obtained by a weighted sum of k neural network modules to be processed, the first indication information indicating the weight of each neural network module to be processed in the second neural network module, where N is an integer greater than or equal to 1. The network device generates a second neural architecture unit based on the first indication information and the k neural network modules to be processed, and generates a second neural network based on the generated second neural architecture unit, the second neural network including at least one second neural architecture unit; training the second neural network to update the first indication information until a preset condition is met, obtaining updated first indication information. The network device generates a first neural architecture unit based on the updated first indication information and the k neural network modules to be processed, and generates a target neural network based on the generated first neural architecture unit, wherein the updated first indication information indicating the probability of each neural network module to be processed appearing in the first neural architecture unit, and the target neural network including at least one first neural architecture unit. Furthermore, the network device generates a first neural architecture unit based on the updated first instruction information and k neural network modules to be processed, and the specific implementation of generating the target neural network based on the generated first neural architecture unit can be found in the description in the first aspect.
[0019] This application provides another implementation method for automatically generating target neural networks, which improves the implementation flexibility of this solution.
[0020] In one possible implementation of the second aspect, the first indication information is included in a k-dimensional Dirichlet distribution space, which contains multiple vectors, each vector including k elements, all of which are non-negative real numbers, and the sum of the aforementioned k elements is 1.
[0021] In one possible implementation of the second aspect, the network device trains a second neural network to update the first indication information. This may include: the network device inputting target training data into the second neural network, generating a prediction result corresponding to the target training data through the second neural network, and generating a target loss function value based on the expected result and the prediction result corresponding to the target training data. The target loss function is used to indicate the similarity between the expected result and the prediction result corresponding to the target training data. The network device generates a target score corresponding to the second neural network, which is used to indicate the performance of the second neural network in processing target data. The network device keeps the second weight parameter in the second neural network unchanged and updates the parameter value of the first weight parameter in the second neural network in reverse according to the target score; keeps the first weight parameter in the second neural network unchanged and updates the parameter value of the second weight parameter in the second neural network in reverse according to the target loss function value. Here, the first weight parameter refers to the weight parameter corresponding to each neural network module to be processed in the second neural network, that is, the first weight parameter is the weight parameter corresponding to the first indication information; the second weight parameter refers to the weight parameters in the second neural network other than the first weight parameter.
[0022] Thirdly, embodiments of this application provide a data processing method that can be used in the field of NAS (Network Attached Storage) technology within the field of artificial intelligence. The method may include: a network device inputting target data into a target neural network, processing the target data through the target neural network, and obtaining a prediction result corresponding to the target data; wherein the target neural network includes at least one first neural architecture unit, the first neural architecture unit being obtained based on first indication information and k neural network modules to be processed, the first indication information being used to indicate the probability and / or frequency of each neural network module appearing in the first neural architecture unit among the k neural network modules to be processed, and k being a positive integer.
[0023] In one possible implementation of the third aspect, the first instruction information is included in the Dirichlet distribution space.
[0024] The meanings of the terms in the third aspect of the embodiments of this application can be referred to the descriptions in the various possible implementations of the first aspect, and will not be repeated here.
[0025] Fourthly, embodiments of this application provide a neural network acquisition device, which can be used in the field of NAS (Neural Network Acquisition) technology in the field of artificial intelligence. The neural network acquisition device includes: an acquisition unit, configured to acquire first indication information corresponding to a first neural architecture unit, the first indication information indicating the probability and / or frequency of each of k candidate neural network modules appearing in the first neural architecture unit, where k is a positive integer; a generation unit, configured to generate the first neural architecture unit based on the first indication information and the k candidate neural network modules, and generate a first neural network based on the generated first neural architecture unit, the first neural network including at least one first neural architecture unit; the acquisition unit is further configured to acquire a target score corresponding to the first indication information, the target score indicating the performance of the first neural network corresponding to the first indication information when processing target data; the acquisition unit is further configured to acquire second indication information from multiple first indication information based on multiple target scores corresponding to multiple first indication information, and acquire a target neural network corresponding to the second indication information.
[0026] The neural network acquisition device provided in the fourth aspect of the embodiments of this application can also perform the steps executed by the network device in the various possible implementations of the first aspect. For the specific implementation steps of the fourth aspect of the embodiments of this application and the various possible implementations of the fourth aspect, as well as the beneficial effects brought about by each possible implementation, please refer to the description in the various possible implementations of the first aspect, which will not be repeated here.
[0027] Fifthly, embodiments of this application provide a neural network acquisition device, which can be used in the field of NAS (Neural Network Architecture) technology in the field of artificial intelligence. The neural network acquisition device includes: an acquisition unit, configured to acquire first indication information corresponding to a second neural architecture unit, wherein the second neural architecture unit includes N second neural network modules, each second neural network module being obtained by weighted summation of k neural network modules to be processed, the first indication information indicating the weight of each neural network module to be processed in the second neural network module, and N being an integer greater than or equal to 11; a generation unit, configured to generate a second neural architecture unit based on the first indication information and the k neural network modules to be processed, and generate a second neural network based on the generated second neural architecture unit, the second neural network including at least one second neural architecture unit; a training unit, configured to train the second neural network to update the first indication information until a preset condition is met, obtaining updated first indication information; and a generation unit, configured to generate a first neural architecture unit based on the updated first indication information and the k neural network modules to be processed, and generate a target neural network based on the generated first neural architecture unit, wherein the updated first indication information indicating the probability of each neural network module to be processed appearing in the first neural architecture unit, and the target neural network including at least one first neural architecture unit.
[0028] The neural network acquisition device provided in the fifth aspect of the present application can also execute the steps executed by the network device in the various possible implementations of the second aspect. For the specific implementation steps of the fifth aspect and the various possible implementations of the fifth aspect, as well as the beneficial effects brought by each possible implementation, please refer to the description in the various possible implementations of the second aspect, which will not be repeated here.
[0029] Sixthly, embodiments of this application provide a data processing apparatus that can be used in the field of NAS (Neural Network Architecture) technology within the field of artificial intelligence. The data processing apparatus includes: an input unit for inputting target data into a target neural network; and a processing unit for processing the target data through the target neural network to obtain a prediction result corresponding to the target data. The target neural network includes at least one first neural architecture unit, which is obtained based on first indication information and k neural network modules to be processed. The first indication information indicates the probability and / or frequency of each neural network module appearing in the first neural architecture unit among the k neural network modules to be processed, where k is a positive integer.
[0030] The neural network acquisition device provided in the sixth aspect of the embodiments of this application can also perform the steps of the execution device in the various possible implementations of the third aspect. For the specific implementation steps of the sixth aspect of the embodiments of this application and the various possible implementations of the sixth aspect, as well as the beneficial effects brought by each possible implementation, refer to the description in the various possible implementations of the third aspect, which will not be repeated here.
[0031] In a seventh aspect, embodiments of this application provide a computer program product that, when run on a computer, causes the computer to execute the neural network processing method described in the first or second aspect above, or causes the computer to execute the data processing method described in the third aspect above.
[0032] Eighthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when run on a computer, causes the computer to perform the neural network processing method described in the first or second aspect, or to perform the data processing method described in the third aspect.
[0033] Ninthly, embodiments of this application provide a network device that may include a processor and a memory coupled together. The memory stores program instructions, and when the program instructions stored in the memory are executed by the processor, the neural network acquisition method described in the first or second aspect is implemented.
[0034] In a tenth aspect, embodiments of this application provide an execution device that may include a processor and a memory coupled together. The memory stores program instructions, and when the program instructions stored in the memory are executed by the processor, the data processing method described in the third aspect above is implemented.
[0035] Eleventhly, embodiments of this application provide a circuit system including a processing circuit configured to execute the neural network processing method described in the first or second aspect above, or the processing circuit configured to execute the data processing method described in the third aspect above.
[0036] In a twelfth aspect, embodiments of this application provide a chip system including a processor for implementing the functions involved in the foregoing aspects, such as transmitting or processing data and / or information involved in the foregoing methods. In one possible design, the chip system further includes a memory for storing program instructions and data necessary for a server or communication device. This chip system may be composed of chips or may include chips and other discrete devices. Attached Figure Description
[0037] Figure 1aA schematic diagram of the main framework of artificial intelligence provided in the embodiments of this application;
[0038] Figure 1b An application scenario diagram of the neural network acquisition method provided in the embodiments of this application;
[0039] Figure 2a A schematic diagram of an architecture for a neural network acquisition system provided in an embodiment of this application;
[0040] Figure 2b A schematic diagram of another architecture of the neural network acquisition system provided in the embodiments of this application;
[0041] Figure 3a A schematic diagram illustrating the relationship between the neural network and neural architecture units in the neural network acquisition method provided in this application embodiment;
[0042] Figure 3b A schematic diagram illustrating the relationship between neural architecture units and neural network modules in the neural network acquisition method provided in this application embodiment;
[0043] Figure 3c A flowchart illustrating a method for obtaining a neural network provided in an embodiment of this application;
[0044] Figure 4 A flowchart illustrating a method for obtaining a neural network provided in an embodiment of this application;
[0045] Figure 5 This is a schematic diagram illustrating the relationship between the rounded target result and N first neural network modules in the neural network acquisition method provided in this application embodiment.
[0046] Figure 6 A schematic diagram illustrating the relationship between N first neural network modules and a first neural architecture unit in the neural network acquisition method provided in this application embodiment;
[0047] Figure 7 A schematic diagram of a first neural network in the method for obtaining a neural network provided in this application embodiment;
[0048] Figure 8 Another flowchart illustrating the method for obtaining a neural network provided in this application embodiment;
[0049] Figure 9 A flowchart illustrating a method for obtaining a neural network provided in an embodiment of this application;
[0050] Figure 10 A schematic flowchart of a data processing method provided in an embodiment of this application;
[0051] Figure 11 A schematic diagram illustrating the beneficial effects of the neural network acquisition method provided in the embodiments of this application;
[0052] Figure 12 A schematic diagram of a neural network acquisition device provided in an embodiment of this application;
[0053] Figure 13 Another schematic diagram of the neural network acquisition device provided in the embodiments of this application;
[0054] Figure 14 Another schematic diagram of the neural network acquisition device provided in the embodiments of this application;
[0055] Figure 15 A schematic diagram of the structure of a data processing apparatus provided in an embodiment of this application;
[0056] Figure 16 A schematic diagram of the structure of a network device provided in an embodiment of this application;
[0057] Figure 17 A schematic diagram of the structure of the execution device provided in the embodiments of this application;
[0058] Figure 18 This is a schematic diagram of a chip structure provided in an embodiment of this application. Detailed Implementation
[0059] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such terms are interchangeable where appropriate; this is merely a way of distinguishing objects with the same attributes in the embodiments of this application. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion, so that a process, method, system, product, or apparatus that comprises a series of elements is not necessarily limited to those elements, but may include other elements not explicitly listed or inherent to those processes, methods, products, or apparatuses.
[0060] The embodiments of this application will now be described with reference to the accompanying drawings. Those skilled in the art will recognize that, with technological advancements and the emergence of new scenarios, the technical solutions provided in the embodiments of this application are equally applicable to similar technical problems.
[0061] First, the overall workflow of the artificial intelligence system is described; please refer to [link / reference]. Figure 1a , Figure 1aThe diagram illustrates a structural framework for artificial intelligence (AI). The framework is further elaborated below along two dimensions: the "Intelligent Information Chain" (horizontal axis) and the "IT Value Chain" (vertical axis). The "Intelligent Information Chain" reflects a series of processes from data acquisition to processing. For example, it could be the general process of intelligent information perception, intelligent information representation and formation, intelligent reasoning, intelligent decision-making, and intelligent execution and output. In this process, data undergoes a condensation process of "data—information—knowledge—wisdom." The "IT Value Chain" reflects the value that AI brings to the information technology industry, from the underlying infrastructure of human intelligence and information (provided and processed by technology) to the industrial ecosystem of the system.
[0062] (1) Infrastructure
[0063] The infrastructure provides computing power to support artificial intelligence systems, enabling communication with the external world and providing support through a basic platform. Communication with the outside world is achieved through sensors; computing power is provided by intelligent chips, which can specifically employ hardware acceleration chips such as central processing units (CPUs), neural-network processing units (NPUs), graphics processing units (GPUs), application-specific integrated circuits (ASICs), or field-programmable gate arrays (FPGAs). The basic platform includes distributed computing frameworks and related platform guarantees and support, which may include cloud storage and computing, interconnected networks, etc. For example, sensors communicate with the outside world to acquire data, and this data is provided to intelligent chips in the distributed computing system provided by the basic platform for computation.
[0064] (2) Data
[0065] The data at the next layer of infrastructure is used to represent the data sources in the field of artificial intelligence. The data involves graphics, images, voice, text, and IoT data from traditional devices, including business data from existing systems and sensor data such as force, displacement, liquid level, temperature, and humidity.
[0066] (3) Data processing
[0067] Data processing typically includes methods such as data training, machine learning, deep learning, search, reasoning, and decision-making.
[0068] Among them, machine learning and deep learning can perform intelligent information modeling, extraction, preprocessing, and training on data, including symbolization and formalization.
[0069] Reasoning refers to the process in which, in a computer or intelligent system, the machine thinks and solves problems by simulating human intelligent reasoning, based on reasoning control strategies and using formalized information. Typical functions include search and matching.
[0070] Decision-making refers to the process of making decisions based on intelligent information after reasoning, and it typically provides functions such as classification, sorting, and prediction.
[0071] (4) General ability
[0072] After the data processing mentioned above, the results of the data processing can be used to form some general capabilities, such as algorithms or a general system, for example, translation, text analysis, computer vision processing, speech recognition, image recognition, etc.
[0073] (5) Smart products and industry applications
[0074] Intelligent products and industry applications refer to products and applications of artificial intelligence systems in various fields. They encapsulate overall artificial intelligence solutions, productize intelligent information decision-making, and realize practical applications. Their application areas mainly include: intelligent terminals, intelligent manufacturing, intelligent transportation, smart homes, intelligent healthcare, intelligent security, autonomous driving, and smart cities.
[0075] This application can be applied to various application scenarios that use artificial intelligence models for data processing. The aforementioned models can be implemented using neural networks or non-neural network models. This application embodiment only uses a neural network as an example for illustration. The neural network can specifically be a convolutional neural network (CNN), a recurrent neural network, a long short-term memory network (LSTM), a transform network, or other types of networks. The neural network architecture of all of the aforementioned neural networks can be automatically determined based on NAS technology.
[0076] Neural architecture search (NAS) is a technique for automatically designing artificial neural networks (ANNs). NAS aims to automatically design the neural architecture of a target neural network with minimal human intervention and computational resource consumption, based on the desired functionality. The process of automatically generating a target neural network using NAS mainly consists of three parts: search space, search strategy, and performance evaluation. Optionally, the process of automatically designing a target neural network using NAS may also include performance prediction.
[0077] The search space defines multiple possible neural network architectures corresponding to the target neural network; the search strategy defines the strategy used in finding the optimal neural network architecture corresponding to the target neural network from the search space; performance prediction is used to predict the performance of the neural network corresponding to the aforementioned neural network architecture without fully training a neural network architecture, in order to assist in selecting a neural network architecture that needs to be fully evaluated from multiple neural network architectures that need to be evaluated; performance evaluation is to train a given neural network architecture and obtain the performance of the trained neural network architecture.
[0078] The target neural network (i.e., the neural network to be automatically generated) is used to process target data, which can be any of the following: image, speech, text, or sequence data. The function of the target neural network can be any of the following: image classification, object detection in an image, image transfer, text translation, speech recognition, regression of sequence data, or other functions, etc., not exhaustively listed here. This application provides various specific application scenarios for the target neural network, greatly expanding the implementation flexibility of this solution.
[0079] As an example, in the field of smart terminals, users often store a large number of pictures on smartphones or other smart electronic devices. Using target neural networks to classify these pictures can help users manage and find them. For a more intuitive understanding of this solution, please refer to [link to relevant documentation]. Figure 1b , Figure 1b The figure illustrates an application scenario of the neural network acquisition method provided in this application. As shown, the task of the convolutional neural network (an example of the target neural network) configured on a smartphone is to classify images in the user's photo album, thereby obtaining... Figure 1b The categorized photo albums shown above, the aforementioned convolutional neural network can be automatically generated using NAS technology, as should be understood. Figure 1b This is merely an example to facilitate understanding of the application scenario of this solution and is not intended to limit the scope of this solution.
[0080] As another example, in fields such as smart terminals, autonomous driving, smart security, and smart cities, after acquiring an image to be processed, electronic devices need to use the convolutional neural network (an example of a target neural network) configured on the electronic device to perform target detection on the image in order to obtain the detection result. The convolutional neural network used can be automatically generated using NAS technology, etc. The application scenarios of the embodiments of this application will not be exhaustively listed here.
[0081] Before providing a detailed description of the neural network processing method provided in the embodiments of this application, let's first combine... Figure 2a and Figure 2b This application introduces two neural network acquisition systems provided in its embodiments. Please refer to [the relevant documentation / reference]. Figure 2a , Figure 2a This is a schematic diagram of an architecture for a neural network acquisition system provided in an embodiment of this application. The neural network acquisition system 200 includes a client 210 and a first network device 220.
[0082] Users can input the target requirements information corresponding to the neural network to be built through the client 210. The target requirements information can include the functions of the neural network to be built. For example, the functions of the neural network to be built can be image classification, image transfer, text translation, speech recognition or other types of functions, etc., which are not exhaustive here.
[0083] Client 210 sends target requirement information to first network device 220. Based on the target requirement information, first network device 220 determines the type of neural network to be built, automatically generates the target neural network, and then sends the target neural network to client 210.
[0084] See also Figure 2b , Figure 2b This is a schematic diagram of another architecture for the neural network acquisition system provided in this application embodiment. The neural network acquisition system 200 includes a first network device 220, a network device 230, a database 240, an execution device 250, and a data storage system 260. The execution device 250 includes a computing module 251. The first network device 220 and the network device 230 can be integrated into the same device or they can be two different devices.
[0085] In this process, after determining the type of neural network to be constructed, the first network device 220 automatically generates a target neural network and sends it to the network device 230. The database 240 stores a training dataset. After obtaining the target neural network, the network device 220 uses the training data in the database 240 to iteratively train the target neural network, resulting in a mature target neural network.
[0086] After obtaining the mature target neural network, the network device 230 will deploy it to the execution device 250. The computing module 251 in the execution device 250 can process data through the target neural network. The execution device 250 can be manifested in different systems or devices, such as mobile phones, tablets, laptops, VR devices, monitoring systems, radar data processing systems, etc. The specific form of the execution device 250 can be flexibly determined according to the actual application scenario, and is not limited here.
[0087] The execution device 250 can access data, code, etc., in the data storage system 260, and can also store data, instructions, etc., in the data storage system 260. The data storage system 260 can be located within the execution device 250, or it can be an external memory relative to the execution device 250.
[0088] In some embodiments of this application, please refer to Figure 2b The "user" can directly interact with the execution device 250, meaning the execution device 250 can directly display the processing results output by the target neural network to the "user." It is worth noting that... Figure 2a and Figure 2b These are merely schematic diagrams of two architectures of the neural network acquisition system provided in this embodiment of the invention. The positional relationships between the devices, components, modules, etc., shown in the diagrams do not constitute any limitation. For example, in some other embodiments of this application, Figure 2b The execution device 250 and the client device can also be separate independent devices. The execution device 250 is configured with an input / output (in / out, I / O) interface, and the execution device 250 interacts with the client device through the I / O interface.
[0089] A target neural network includes at least one neural architecture cell; a neural architecture cell may include N neural network modules, and the first network device 220 is configured with k selectable neural network modules. The aforementioned k selectable neural network modules are used for the first network device 220 to automatically construct a neural architecture cell. N and k are both positive integers. The specific number of neural network modules included in a neural architecture cell and the number of selectable neural network modules will be flexibly determined based on the actual application scenario, and are not limited here.
[0090] As an example, if the target neural network is a convolutional neural network (CNN), then a neural architecture unit can be a convolutional unit. A convolutional unit can include only convolutional layers, or it can include convolutional layers and pooling layers, or it can include more or fewer types of neural network layers, etc. There are no limitations here.
[0091] Furthermore, a convolutional layer can include multiple convolution operators, also known as kernels. In image processing, a convolution operator acts as a filter to extract specific information from the input image matrix. Essentially, a convolution operator can be a weight matrix, which is usually predefined. During the convolution operation on the image, the weight matrix is typically processed along the horizontal direction of the input image, pixel by pixel (or two pixels by two pixels, depending on the stride value), thereby completing the task of extracting specific features from the image.
[0092] As another example, if the target neural network is a recurrent neural network (RNN), then a neural architecture unit can be a recurrent cell. It should be noted that the target neural network can also be a transformer network or other types of neural networks. The examples here are only for the convenience of understanding the relationship between neural networks, neural architecture units, and neural network modules, and are not intended to limit this solution.
[0093] To understand this solution more intuitively, please refer to [link / reference]. Figure 3a and Figure 3b , Figure 3a This is a schematic diagram illustrating the relationship between the neural network and neural architecture units in the neural network acquisition method provided in this application embodiment. Figure 3b This is a schematic diagram illustrating the relationship between neural architecture units and neural network modules in the neural network acquisition method provided in this application embodiment. (See also: [link to previous text]) Figure 3a , Figure 3a Taking the function of the first neural network as classifying input images as an example, as shown in the figure, the first neural network can include three first neural architecture units. In addition to the first neural architecture units, the first neural network can also include other neural network layers, such as the input layer and classifier shown in the figure. It should be understood that... Figure 3a The examples in this document are for illustrative purposes only and are not intended to limit the scope of this solution.
[0094] See also Figure 3b , Figure 3bTaking an N value of 8 as an example, the 8 neural network modules included in a neural architecture unit are as follows: Figure 3a The algorithm consists of four sep_conv_3×3 operations, one sep_pool_3×3 operation, one sep_conv_5×5 operation, one skip_connect operation, and one dil_conv_5×5 operation. The sep_conv_3×3, sep_conv_5×5, and dil_conv_5×5 operations perform convolution, the sep_pool_3×3 operation performs pooling, and the skip_connect operation performs concatenation. Figure 3b In this context, 0, 1, 2, and 3 represent other nodes located between the input and output nodes. That is, a neural architecture unit, in addition to including the neural network module, can also include input nodes, output nodes, and other nodes located between the input and output nodes. It should be understood that... Figure 3b The examples in this document are for illustrative purposes only and are not intended to limit the scope of this solution.
[0095] To reduce the computer resources consumed and the time required for the entire process of "automatically generating the target neural network," this application provides a method for obtaining a neural network. Please refer to... Figure 3c , Figure 3c This is a flowchart illustrating a method for acquiring a neural network according to an embodiment of this application. A1. A first network device acquires first indication information corresponding to a first neural architecture unit. The first indication information is only used to indicate the probability and / or frequency of each neural network module appearing in the neural architecture unit among k selectable neural network modules. Since researchers have found that if different neural architecture units have the same neural network modules, but the topological relationships corresponding to the different neural network modules are different, the performance of the aforementioned multiple different neural architecture units in processing target data is often very similar. Therefore, in this embodiment of the application, the first indication information is not used to indicate the topological relationships between different neural network modules.
[0096] A2. The first network device generates a first neural architecture unit based on the first instruction information and k selectable neural network modules, and generates a first neural network based on the generated first neural architecture unit. The first neural network is a neural network for processing target data, and the first neural network includes at least one first neural architecture unit.
[0097] A3. The first network device acquires the target score corresponding to the first instruction information. The target score is used to indicate the performance of the first neural network corresponding to the first instruction information when processing target data.
[0098] A4. The first network device obtains second indication information from at least one first indication information based on at least one target score, and obtains a target neural network corresponding to the second indication information, wherein the probability of the first indication information corresponding to the first neural network being selected is related to the target score corresponding to the first neural network.
[0099] As can be seen from the above description in this embodiment, the second indication information is obtained from at least one first indication information, and then the target neural network corresponding to the second indication information is obtained. The first indication information is only used to indicate the probability and / or number of times each neural network module appears in the neural architecture unit among the k neural network modules, and is no longer used to indicate the topological relationship between different neural network modules. This greatly reduces the search space corresponding to the neural architecture unit, which not only reduces the computer resources required for the entire neural network acquisition process, but also saves time costs.
[0100] This application provides not only the process of automatically generating the target neural network, but also the reasoning process of the target neural network. The specific implementation flow of the two stages mentioned above will be described below.
[0101] I. Stages of Automatically Generating the Target Neural Network
[0102] For specific details in the embodiments described in this application, please refer to [link / reference]. Figure 4 , Figure 4 This is a flowchart illustrating a method for obtaining a neural network according to an embodiment of this application. The method for obtaining a neural network according to an embodiment of this application may include:
[0103] 401. The network device acquires first indication information corresponding to the first neural architecture unit. The first indication information is used to indicate the probability and / or number of times each neural network module appears in the neural architecture unit among the k neural network modules.
[0104] In this embodiment, before constructing the first neural architecture unit, the network device can obtain the first indication information corresponding to the first neural architecture unit according to a preset search strategy. The network device is configured with k candidate neural network modules, and one neural architecture unit includes N neural network modules. That is, the network device needs to determine N neural network modules based on the k candidate neural network modules to generate a neural architecture unit. It should be noted that the values of k and N can be pre-configured in the network device or sent to the network device by other devices. Optionally, the network device can also pre-store the maximum number of connections between the neural network modules within the first neural architecture unit, the number of first neural architecture units in the final target neural network, or other parameters. The specific types of information pre-stored on the network device can be flexibly determined based on the actual application scenario.
[0105] The first indication information is used to indicate the probability and / or frequency of each of the k candidate neural network modules appearing in the aforementioned neural architecture unit. If the first indication information is used to indicate the probability of each of the k candidate neural network modules appearing in the aforementioned neural architecture unit, then the first indication information may include a vector of k elements corresponding one-to-one with the k candidate neural network modules, where the sum of the aforementioned k elements is 1. For example, the first indication information can be represented as a vector located in a k-dimensional simplex space, as shown in the following example:
[0106] (1)
[0107] in, Represents the first instruction message, This represents the i-th element in a first instruction message. This represents the probability that the i-th neural network module among the k candidate neural network modules appears in the first neural architecture unit. The number of times the i-th neural network module appears in the first neural architecture unit among the k candidate neural network modules should be understood. The example in Equation (1) is only for the convenience of understanding this scheme and is not intended to limit this scheme.
[0108] Specifically, in one implementation, the first indication information in step 401 is obtained based on the Dirichlet distribution principle. That is, the first indication information is included in a k-dimensional first Dirichlet distribution space. "Obtaining the first indication information based on the Dirichlet distribution principle" means that the preset search strategy includes random sampling in the Dirichlet distribution space. The k-dimensional Dirichlet distribution space contains multiple vectors, each containing k elements, all of which are non-negative real numbers, and the sum of these k elements is 1. In this implementation, the first indication information is used to indicate the probability of each of the k neural network modules appearing in the neural architecture unit.
[0109] Furthermore, since the network device is acquiring the first indication information for the first time in step 401, it can first determine the first Dirichlet distribution space based on the first distribution parameters, and then randomly sample from the first Dirichlet distribution space to obtain the first indication information. Here, the first distribution parameters are initial distribution parameters, including k parameters that correspond one-to-one with the aforementioned k elements. These first distribution parameters are related to... The probability density function corresponding to the Dirichlet distribution space of dimension 1 is given below. To make this scheme more intuitively understandable, the formulas for the distribution parameters corresponding to the Dirichlet distribution space are disclosed as follows:
[0110] (2)
[0111] in, The probability density function represents the first Dirichlet distribution space corresponding to the first indication information. The distribution parameter (i.e. the first distribution parameter) corresponds to each of the k elements included in the first indication information. All are positive real numbers. For example, The values of can all be 1, then the first Dirichlet distribution space is a completely uniformly distributed space. It should be understood that the examples in equation (2) are only for the convenience of understanding this scheme and are not used to limit this scheme.
[0112] In this embodiment of the application, since the sum of the k elements in each vector is 1 in the Dirichlet distribution space, and the Dirichlet distribution space is a uniformly distributed space, the first indication information can be easily collected based on the Dirichlet distribution principle, which reduces the difficulty of obtaining the first indication information in this solution.
[0113] Optionally, the preset search strategy may include random sampling in the Dirichlet distribution space and a Bayesian optimization (BO) algorithm. The network device can obtain multiple first indication information corresponding to the first neural architecture unit based on the Dirichlet distribution principle and the Bayesian optimization algorithm. Specifically, the network device can sample T first indication information in the first Dirichlet distribution space, where T is an integer greater than or equal to 1.
[0114] In another implementation, the preset search strategy includes an evolutionary algorithm. The first indication information in this implementation is used to indicate the probability and / or frequency of each of the k candidate neural network modules appearing in the aforementioned neural architecture unit. Specifically, step 401 may include: the network device acquiring S pieces of first indication information. Since the values of N and k are determined, the network device can determine the value of S. Given the specific forms of the S first indication information, the network device can select at least one first indication information from the S first indication information based on the evolutionary algorithm, where S is an integer greater than or equal to 1.
[0115] Optionally, if the preset search strategy includes an evolutionary algorithm and a Bayesian optimization algorithm, the network device can also select T first indication information from S first indication information based on the evolutionary algorithm and the Bayesian optimization algorithm.
[0116] In another implementation, the preset search strategy includes random selection. The first indication information in this implementation is used to indicate the probability and / or frequency of each of the k candidate neural network modules appearing in the aforementioned neural architecture unit. Specifically, step 401 may include: the network device acquiring S pieces of first indication information and randomly selecting at least one piece of first indication information from the S pieces of first indication information. The meaning of the S pieces of first indication information can be found in the above description.
[0117] Optionally, the preset search strategy includes random selection and Bayesian optimization algorithm. The network device can also randomly select T first indication information from S first indication information based on the Bayesian optimization algorithm.
[0118] It should be noted that the preset search strategy can also use other types of search strategies, which will not be listed here.
[0119] 402. The network device generates a first neural architecture unit based on the first instruction information and k neural network modules.
[0120] In this embodiment of the application, after the network device obtains one or T first indication information through step 401, it determines N first neural network modules based on each first indication information and k selectable neural network modules. The N first neural network modules are all included in the k selectable neural network modules.
[0121] The network device generates one or more first neural architecture units based on the determined N first neural network modules. Each first neural architecture unit includes N first neural network modules.
[0122] This describes the process by which a network device determines N first neural network modules based on a first indication information and k neural network modules. Specifically, in one implementation, if the first indication information is obtained based on a Dirichlet distribution, since the obtained first indication information is any point in the k-dimensional simplex space, and the valid first indication information that can generate the first neural architecture unit needs to be a point on a regular grid in the k-dimensional simplex space, multiplying the valid first indication information by N yields k integers. However, the first indication information obtained in step 401 is not necessarily all valid first indication information, so the first indication information obtained in step 401 needs to be processed.
[0123] More specifically, the network device can multiply each first probability value by N to obtain the target result, which includes k first values, each indicating the probability of a neural network module appearing in a neural architecture unit. The network device then rounds each first value in the target result to obtain a rounded target result, which includes k second values, each indicating the number of times a neural network module appears in a neural architecture unit. All k second values are integers, and their sum is N. Based on the rounded target result and the k neural network modules, the network device determines N first neural network modules, which satisfy the constraints of the rounded target result. To further understand this scheme, the above rounding operation is illustrated below using formulas:
[0124] (3)
[0125] in, Represents the target result, that is , This represents the i-th value in the target result. Represents the integer part of the i-th value in the target result. represent The decimal part, that is, the decimal part representing the k values in the target result, can be found to be... It is a non-negative integer.
[0126] Network equipment will The largest All values are rounded down to 1. The remaining values are all rounded down to 0 to obtain a composition of 1s and 0s. dimensional vector ,but For the target result after rounding, That is, the one obtained through step 401 The closest and most effective indication information between them. The aforementioned distance can be Euclidean distance, cosine distance, L1 distance, Mahalanobis distance or other types of distance, etc. It should be understood that the example in equation (3) is only an example of rounding.
[0127] To more intuitively understand the relationship between the rounded target result, the k neural network modules, and the N first neural network modules, please refer to [link / reference needed]. Figure 5 , Figure 5 This is a schematic diagram illustrating the relationship between the rounded target result and N first neural network modules in the neural network acquisition method provided in this application embodiment. Figure 5 Taking N as an example and k as an example (e.g., N = 8, k = 7), Figure 5As shown, the rounded target result includes seven second values corresponding one-to-one with neural network modules 1 to 7. These seven second values are 0, 0, 2, 1, 2, 0, and 3. Therefore, the eight first neural network modules include two neural network modules 3, one neural network module 4, two neural network modules 5, and three neural network modules 7. It should be understood that... Figure 5 The examples in this document are for illustrative purposes only and are not intended to limit the scope of this solution.
[0128] In this embodiment, since the first indication information is sampled from the Dirichlet distribution space, it can only guarantee that the sum of the k first probability values is 1, and cannot guarantee that the product of each first probability value and N is an integer. Therefore, each first value in the target result can be rounded to obtain the rounded target result. The rounded target result includes k second values, all of which are integers and the sum of the k second values is N. Each second value is used to indicate the number of times a neural network module appears in the neural architecture unit. Based on the rounded target result, the first neural architecture unit is constructed, thereby ensuring the smoothness of the construction process of the first neural architecture unit.
[0129] In another implementation, the first indication information may be selected from S first indication information based on an evolutionary algorithm, random selection, or other search strategy; or the first indication information may be obtained based on a Dirichlet distribution. Network devices can obtain N first neural network modules by sampling from k neural network modules based on the obtained first indication information. The first indication information is used to indicate the probability that each of the k neural network modules is sampled.
[0130] To further understand this scheme, the sampling process is illustrated below using formulas:
[0131] (4)
[0132] Where Categorical represents a multinomial distribution, and for the sampling process of each of the N first neural network modules, the network device uses... As the probability of each neural network module being sampled in k neural network modules, this sampling operation is performed. The network device repeats the above operation N times, and can sample N target neural networks. It should be understood that the example in equation (4) is only an example for the convenience of understanding this scheme.
[0133] In this embodiment, N first neural network modules are sampled directly from k neural network modules based on the first instruction information, and then a first neural architecture unit is generated based on the sampled N first neural network modules. This provides another specific implementation method for generating a first neural architecture unit based on the first instruction information, which improves the implementation flexibility of this solution and is simple to operate and easy to implement.
[0134] In another implementation, if the first indication information is selected from S first indication information based on evolutionary algorithms, random selection, or other search strategies, since each of the S first indication information is a valid indication information, the network device can directly multiply each value included in the first indication information obtained in step 401 by N to obtain a first result. The first result includes k third values corresponding one-to-one with the k candidate neural network modules. Each third value is used to indicate the number of times one of the candidate neural network modules appears in the first architecture unit. Based on the first result and the k candidate neural network modules, the network device determines N first neural network modules.
[0135] It should be noted that if the network device obtains T first indication information in step 401, then in step 402, the network device can perform the above operation according to each of the T first indication information to obtain T groups of neural network modules, each group of neural network modules including N neural network modules.
[0136] This describes the process by which a network device generates a first neural architecture unit based on N first neural network modules. Specifically, the network device may store a first rule, and the network device generates H first neural architecture units based on the N first neural network modules and the first rule, where H is an integer greater than or equal to 1.
[0137] The first rule indicates which N locations in the first neural architecture unit lack neural network modules. In addition to N first neural network modules, the first neural architecture unit may also include input nodes and output nodes; optionally, the first neural architecture unit may also include at least one target node, which is a node located between the input and output nodes, in which case the first rule further indicates the position of each target node in the first neural architecture unit.
[0138] It should be noted that the specific number of first neural architecture units generated (i.e., the value of H) can be determined based on the total number of neural architecture units required in the entire first neural network. Since the first instruction information only specifies which neural network modules are used in the first neural architecture unit (i.e., only N first neural network modules are determined), it does not specify the topological relationship between these N first neural network modules, that is, it does not specify the order or connection method of these N first neural network modules. Therefore, the topological relationship corresponding to different first neural architecture units in the H first neural architecture units can be different, or the topological relationship corresponding to different first neural architecture units in the H first neural architecture units can be the same.
[0139] Optionally, if the first neural network includes at least two first neural architecture units, then different first neural architecture units all include the above-mentioned N first neural network modules, but the topological relationships corresponding to the N first neural network modules in different first neural architecture units can be the same or different.
[0140] For a more intuitive understanding of this solution, please refer to [link / reference]. Figure 6 , Figure 6 Can be combined Figure 3a To understand, Figure 6 This is a schematic diagram illustrating the relationship between N first neural network modules and a first neural architecture unit in the neural network acquisition method provided in this application embodiment. Figure 6 Taking a value of k of 6 and a value of N of 8 as an example, the 8 first neural network modules include 4 neural network modules 1, 2 neural network modules 2, 0 neural network modules 3, 2 neural network modules 4, 0 neural network modules 5, and 0 neural network modules 6. Figure 6 The figure illustrates two different first neural architecture units and their corresponding topological relationships: neural architecture unit A, the topological relationship corresponding to neural architecture unit A, and the topological relationship corresponding to neural architecture unit B, as shown in the figure. Although neural architecture units A and B contain the same eight first neural network modules, they are specifically different neural architecture units. Since the first instruction information does not limit the topological relationships between different first neural network modules, the same first instruction information can correspond to multiple different neural architecture units. It should be understood that... Figure 6 The examples in this document are for illustrative purposes only and are not intended to limit the scope of this solution.
[0141] Optionally, if T first indication information is obtained through step 401, then in step 402, for any one of the T first indication information, the network device can obtain a neural architecture unit set, and a neural architecture unit set includes one or more first neural architecture units; the network device performs the above operation on each of the T first indication information to obtain T neural architecture unit sets.
[0142] 403. The network device generates a first neural network based on a first neural architecture unit, the first neural network including at least one first neural architecture unit.
[0143] In this embodiment of the application, the network device may pre-store the second rule. After generating H first neural architecture units through step 402, a first neural network can be generated according to the second rule and the H first neural architecture units. The first neural network is used to process target data and includes H first neural architecture units.
[0144] The second rule indicates which C positions in the first neural network lack the first neural architecture unit. The first neural network may also include multiple target neural network layers, which are neural network layers other than the first neural architecture unit. The specific target neural network layers included in the first neural network need to be determined based on the specific function of the first neural network. For example, if the first neural network is used for image classification, a first neural architecture unit is a convolutional unit. The first neural network may include a feature extraction network and a classification network. In this case, the first neural architecture unit is included in the feature extraction network, and the classification network may include multiple target neural network layers, etc. It should be understood that this example is only for the convenience of understanding the relationship between the first neural architecture unit and the first neural network and is not intended to limit this scheme.
[0145] Furthermore, if the first neural network includes multiple first neural architecture units, then the first neural network can employ multiple different first neural architecture units or multiple identical first neural architecture units.
[0146] For a more intuitive understanding of this solution, please refer to [link / reference]. Figure 7 , Figure 7 Can be combined Figure 6 To understand, Figure 7 This is a schematic diagram of a first neural network in the neural network acquisition method provided in the embodiments of this application. Figure 7Taking the first neural network as an example, specifically a convolutional neural network, and its function as image classification, the first neural network includes three different first neural architecture units, as shown in the figure. While all three units use the same first neural network module, the topological relationships between these modules differ. This should be understood. Figure 7 The examples in this document are for illustrative purposes only and are not intended to limit the scope of this solution.
[0147] Optionally, if T sets of neural architecture units are obtained in step 402, then in step 403, the network device can generate a first neural network for any one of the T sets of neural architecture units; the network device can generate T first neural networks based on the T sets of neural architecture units.
[0148] 404. The network device obtains the target score corresponding to the first instruction information, and the target score is used to indicate the performance of the first neural network corresponding to the first instruction information when processing target data.
[0149] In this embodiment of the application, after acquiring the first neural network, the network device needs to acquire the target score corresponding to the first indication information. The target score is used to indicate the performance of the first neural network corresponding to the first indication information when processing target data; the target score may include at least one score value corresponding to at least one score indicator, or the target score may be obtained by weighted summation of the aforementioned at least one score value.
[0150] Furthermore, the at least one scoring metric includes a combination of any one or more of the following metrics: the accuracy of the first neural network in processing the target data, the number of floating-point operations per second (FLOPs) of the first neural network in processing the target data, the amount of storage space occupied by the first neural network, or other performance metrics that can reflect the first neural network, etc.
[0151] Optionally, if the network device generates T first neural networks in step 403, then in step 404, the network device can perform performance prediction on each of the T first neural networks to obtain T first scores corresponding to each of the T first neural networks. Each first score is used to indicate the performance of a first neural network when processing target data. The network device selects the first neural network corresponding to the highest first score from the T first neural networks, and then obtains the target score corresponding to the selected first neural network.
[0152] Specifically, the network device can store training data corresponding to the first neural network. In one implementation, the network device acquires a third neural network corresponding to the first neural network. The third neural network has the same function and network architecture as the first neural network, but it includes fewer neural architecture units than the first neural network, meaning the third neural network is simpler than the first neural network. The network device can use the training data to train the third neural network until a convergence condition is met, resulting in the trained third neural network. The convergence condition can be either satisfying the convergence condition of the loss function or reaching a preset number of training iterations.
[0153] After obtaining the trained third neural network, the network device can generate the score of the trained third neural network on at least one of the above-mentioned scoring indicators, and determine the score of the trained third neural network on at least one of the above-mentioned scoring indicators as the score of the first neural network on at least one of the above-mentioned scoring indicators, thereby obtaining the target score corresponding to the first indication information.
[0154] In another implementation, the network device can directly train the first neural network using training data until a convergence condition is met, thus obtaining the trained first neural network. The convergence condition can be either satisfying the convergence condition of the loss function or reaching a preset number of training iterations. The network device can then generate scores for the trained first neural network on at least one of the aforementioned scoring metrics, thereby obtaining the target score corresponding to the first indication information.
[0155] 405. The network device obtains new first instruction information.
[0156] In this embodiment, the network device needs to obtain new first indication information before generating a new first neural network. In one implementation, the first indication information is obtained based on the Dirichlet distribution principle, that is, the preset search strategy includes random sampling in the Dirichlet distribution space. The network device can obtain new first indication information based on at least one old first indication information and the target score corresponding one-to-one with each old first indication information; the new first indication information is used to indicate the probability of each of the k candidate neural network modules appearing in the first neural architecture unit, and the new first indication information is used to generate a new first neural network.
[0157] Specifically, the network device can determine a first indication information (hereinafter referred to as "target indication information") corresponding to the highest target score from at least one old first indication information and a target score corresponding to each old first indication information, generate a second distribution parameter based on the target indication information, and obtain new first indication information based on the second distribution parameter. The new first indication information is included in a second Dirichlet distribution space, and the second distribution parameter is the distribution parameter of the second Dirichlet distribution space.
[0158] To further understand this scheme, an example of a formula for obtaining new first indication information is disclosed below:
[0159] (5)
[0160] (6)
[0161] in, Represents the second distribution parameter. The probability density function represents the second Dirichlet distribution space corresponding to the new first indication information. This represents the new first indication information obtained from the second Dirichlet distribution space. Including middle, The target indication information represents the target indication information (that is, the first indication information corresponding to the highest target score in at least one old first indication information). This represents the value of the i-th element in the first instruction message. It is a hyperparameter. For non-negative real parameters, The larger the value, the better. and The closer the distance in a k-dimensional simplex space, the better. The closer the value of is to 0, the closer the second Dirichlet distribution space is to a uniform distribution without prior information. It should be understood that the examples in equations (5) and (6) are only for the convenience of understanding this scheme and are not intended to limit this scheme.
[0162] In this embodiment, since the target score corresponding to the old first indication information is higher, it proves that the old first neural network performs better when processing target data. The new first indication information is obtained based on the target score corresponding to each old first indication information, and the new first indication information is used to generate a new first neural network, which is beneficial to obtaining a new first neural network with good performance. Since each first indication information is sampled from the complete Dirichlet distribution space, overfitting to the local space is avoided in the sampling process of the first indication information. This ensures the openness of the sampling process of the first indication information and ensures that the new first neural network is optimized towards a better neural network architecture.
[0163] In another implementation, if step 401 involves the network device obtaining the data based on the Dirichlet distribution principle, meaning the preset search strategy includes random sampling within the Dirichlet distribution space, the network device may also pre-configure a third distribution parameter. This third distribution parameter is conceptually similar to the first distribution parameter and can be the same as or different from the first. Based on the third distribution parameter, the network device determines a new Dirichlet distribution space and then randomly samples from this new space to obtain new first indication information. This new first indication information indicates the probability of each of the k neural network modules appearing in the neural architecture unit, and is used to generate a new first neural network.
[0164] In another implementation, if the first indication information obtained by the network device in step 401 is based on an evolutionary algorithm, i.e., the preset search strategy includes an evolutionary algorithm, then the network device can select a new first indication information from the S first indication information based on the target score obtained in step 404 and the S first indication information. The higher the performance of the trained first neural network, the higher the similarity between the new first indication information and the first indication information obtained in step 401; conversely, the lower the performance of the trained first neural network, the lower the similarity between the new first indication information and the first indication information obtained in step 401.
[0165] In another implementation, if the preset search strategy in step 401 adopts random selection, that is, the preset search strategy includes random selection, then in step 405, the network device can also randomly select a new first indication information from the S first indication information.
[0166] Optionally, if the preset search strategy in step 401 also includes a Bayesian optimization algorithm, that is, if T first indication information is obtained in step 401, then T new first indication information will also be obtained in step 405 according to the Bayesian optimization algorithm.
[0167] 406. The network device generates a new first neural network based on the new first instruction information.
[0168] 407. The network device acquires a new target score corresponding to the new first instruction information. The new target score is used to indicate the performance of the new first neural network corresponding to the new first instruction information when processing target data.
[0169] In this embodiment, the specific implementation of steps 406 and 407 by the network device can be found in the above description of steps 402 to 404, and will not be repeated here. After executing step 407, the network device can re-enter step 405 to continue acquiring new first indication information, and based on the new first indication information, generate a new first neural network, and re-enter step 407. The network device repeats steps 405 to 407 until the first preset condition is met, thereby obtaining multiple target scores corresponding to multiple first indication information, and a first neural network corresponding to each first indication information.
[0170] The first preset condition may be that the number of repetitions of steps 405 to 407 reaches a preset number; or, the first preset condition may be that the time spent by the network device to repeatedly execute steps 405 to 407 reaches a preset duration; or, the target score corresponding to the first indication information is greater than or equal to a preset threshold, etc. The first preset condition may also be other types of preset conditions, which are not limited here.
[0171] 408. The network device obtains second indication information from the multiple first indication information based on multiple target scores corresponding to multiple first indication information, and obtains the target neural network corresponding to the second indication information.
[0172] In this embodiment of the application, after obtaining multiple target scores corresponding to multiple first indication information, the network device can also obtain a second indication information from the multiple first indication information based on the multiple target scores corresponding to the multiple first indication information, and determine a first neural network corresponding to the determined second indication information as the target neural network.
[0173] In one case, the target score corresponding to the second indication information is the highest target score among the multiple target scores corresponding to multiple first indication information; in another case, the higher the value of the target score corresponding to a first indication information, the greater the probability that the first indication information is identified as the second indication information.
[0174] For a more intuitive understanding of this solution, please refer to [link / reference]. Figure 8 , Figure 8 This is another flowchart illustrating the method for obtaining a neural network provided in an embodiment of this application. Figure 8 Taking a value of 5 for k and a value of 7 for N as an example: 1. The network device retrieves a first indication information from the search space corresponding to the first indication information according to a preset search strategy. The search space corresponding to the first indication information includes multiple first indication information. Figure 8 Taking the first indication information as an example to indicate the probability of five candidate neural network modules appearing in the first neural architecture unit. 2. The network device generates three identical first neural architecture units based on the first indication information and the five candidate neural network modules. Figure 8 Taking a first neural network that requires 3 first neural architecture units as an example.
[0175] 3. The network device generates a first neural network based on three identical first neural architecture units and obtains a target score corresponding to the first indication information obtained in step 1. The target score corresponding to the first indication information is used to indicate the performance of the first neural network corresponding to the first indication information when processing target data. 4. The network device updates the search strategy based on the target score corresponding to the first indication information. 5. The network device determines whether a first preset condition is met. If the first preset condition is met, it obtains second indication information from multiple first indication information sets and obtains the target neural network corresponding to the second indication information. If the first preset condition is not met, it obtains a new first indication information from the search space corresponding to the first indication information according to the updated search strategy. It should be understood that... Figure 8 For details on the implementation of each step, please refer to the above description. Figure 8 The examples in this document are for illustrative purposes only and are not intended to limit the scope of this solution.
[0176] In this embodiment, as researchers have discovered, if multiple different neural architecture units possess the same neural network module but the topological relationships corresponding to different neural network modules are different, the performance of the aforementioned multiple different neural architecture units in processing target data is often very similar. In this embodiment, second indication information is obtained from at least one first indication information, and then the target neural network corresponding to the second indication information is obtained. The first indication information is only used to indicate the probability and / or number of times each neural network module appears in the neural architecture unit among the k neural network modules, and is no longer used to indicate the topological relationship between different neural network modules. This greatly reduces the search space corresponding to the neural architecture unit, which not only reduces the computer resources required for the entire neural network acquisition process, but also saves time costs.
[0177] This application also provides another method for obtaining a neural network. For details, please refer to [link to relevant documentation]. Figure 9 , Figure 9This is a flowchart illustrating a method for obtaining a neural network according to an embodiment of this application. The method for obtaining a neural network according to an embodiment of this application may include:
[0178] 901. The network device obtains first indication information corresponding to the second neural architecture unit. The second neural architecture unit includes N second neural network modules. Each second neural network module is obtained by weighted summation of k neural network modules to be processed. The first indication information is used to indicate the weight of each neural network module to be processed in the second neural network module.
[0179] In this embodiment of the application, the network device needs to obtain first indication information corresponding to the second neural architecture unit; wherein, the second neural architecture unit includes N second neural network modules, each second neural network module is obtained by weighted summation of k neural network modules to be processed, and the first indication information is used to indicate the weight of each neural network module to be processed in the second neural network module, that is, the sum of the k values included in the first indication information is 1.
[0180] For details on the specific forms of the first instruction information and how to obtain it, please refer to [link / reference needed]. Figure 4 The description of step 401 in the corresponding embodiment will not be repeated here. It should be noted that the sum of the k values included in the first indication information in this application embodiment is 1.
[0181] 902. The network device generates a second neural architecture unit based on the first instruction information and k neural network modules to be processed.
[0182] In this embodiment, the network device can generate a second neural network module by weighted summation of k neural network modules to be processed according to the first instruction information, and generate a second neural architecture unit according to N second neural network modules and the first rule. The meaning of the first rule can be found in [reference needed]. Figure 4 The description in the corresponding embodiment, "the relationship between the second neural network module and the second neural architecture unit" and Figure 4 The relationship between the first neural network module and the first neural architecture unit in the corresponding embodiment is similar and can be understood by referring to the relevant documentation; it will not be elaborated here.
[0183] 903. The network device generates a second neural network based on the generated second neural architecture unit, the second neural network including at least one second neural architecture unit.
[0184] In this embodiment, the network device can obtain H identical second neural architecture units through step 902, and generate a second neural network according to the second rule and the H first neural architecture units; wherein, H is an integer greater than or equal to 1, and the meaning of the second rule can be found in [reference needed]. Figure 4The description in the corresponding embodiment, "the relationship between the second neural architecture unit and the second neural network" and Figure 4 The relationship between the first neural architecture unit and the first neural network in the corresponding embodiment is similar and can be understood by referring to the relevant documentation; it will not be elaborated here.
[0185] 904. The network device trains the second neural network to update the first instruction information until the preset conditions are met, and obtains the updated first instruction information.
[0186] In this embodiment, the network device may be pre-configured with a training data set corresponding to the second neural network. The network device can use the aforementioned training data set to train the second neural network to update the first weight parameter (i.e., update the first indication information) and the second weight parameter in the second neural network until a preset condition is met, thereby obtaining the updated first indication information and the trained second neural network. The first weight parameter refers to the weight parameter corresponding to each neural network module to be processed in the second neural network; that is, the first weight parameter is the weight parameter corresponding to the first indication information. The second weight parameter refers to the weight parameters in the second neural network other than the first weight parameter.
[0187] Specifically, in one training of the second neural network, the network device can obtain the target training data and the expected result corresponding to the target training data from the training data set, input the target training data into the second neural network, and generate the prediction result corresponding to the target training data through the second neural network.
[0188] The network device generates the value of the target loss function based on the expected result and the predicted result corresponding to the target training data. The target loss function is used to indicate the similarity between the expected result and the predicted result corresponding to the target training data.
[0189] After generating prediction results corresponding to the target training data through the second neural network, the network device can also generate a target score corresponding to the second neural network. This target score indicates the performance of the second neural network in processing the target data. For a more detailed explanation of the concept of target score, please refer to [link to relevant documentation]. Figure 4 The description in the corresponding embodiment.
[0190] The network device keeps the second weight parameter in the second neural network unchanged, and updates the parameter value of the first weight parameter in the second neural network in reverse according to the target score (that is, it realizes the update of the first indication information); and keeps the first weight parameter in the second neural network unchanged, and updates the parameter value of the second weight parameter in the second neural network in reverse according to the target loss function value, thereby completing one training of the second neural network.
[0191] The network device repeats the above operations multiple times to iteratively train the second neural network until the second preset condition is met. The network device can determine the updated first indication information based on the final value of the first weight parameter. The second preset condition can be any one or more of the following: the number of iterations reaches a preset number, the target score is greater than or equal to a preset threshold, or the target loss function meets the convergence condition. The specific form of the target loss function needs to be determined by the specific function of the second neural network and is not limited here.
[0192] 905. The network device generates a first neural architecture unit based on the updated first indication information and k neural network modules to be processed. The updated first indication information is used to indicate the probability of each neural network module to be processed appearing in the first neural architecture unit.
[0193] 906. The network device generates a target neural network based on a first neural architecture unit, wherein the target neural network includes at least one first neural architecture unit.
[0194] In this embodiment, the specific implementation of steps 905 and 906 by the network device can be found in [reference needed]. Figure 4 The specific implementations of steps 402 and 403 in the corresponding embodiments differ only in that: First, in step 402, the network device generates a first neural architecture unit based on the first instruction information and k neural network modules to be processed; in step 905, the network device generates the first neural architecture unit based on the updated first instruction information and k neural network modules to be processed. Second, in step 403, the network device generates a first neural network based on the first neural architecture unit; in step 906, the network device generates a final target neural network based on the first neural architecture unit. The relationship between the target neural network and the first neural network has already been established. Figure 4 The corresponding embodiments have been described, and will not be repeated here.
[0195] This application provides another implementation method for automatically generating target neural networks, which improves the implementation flexibility of this solution.
[0196] II. Inference Stage of the Target Neural Network
[0197] For specific details in the embodiments described in this application, please refer to [link / reference]. Figure 10 , Figure 10 This is a flowchart illustrating a data processing method provided in an embodiment of this application. The data processing method provided in an embodiment of this application may include:
[0198] 1001. The execution device inputs the target data into the target neural network.
[0199] 1002. The execution device processes the target data through the target neural network to obtain a prediction result corresponding to the target data. The target neural network includes at least one first neural architecture unit. The first neural architecture unit is obtained based on first indication information and k neural network modules to be processed. The first indication information is used to indicate the probability and / or number of times each neural network module in the k neural network modules to be processed appears in the first neural architecture unit.
[0200] In this embodiment, the specific representation of the target data, the specific representation of the target neural network, the relationship between the target neural network and the first neural architecture unit, and the relationship between the first neural architecture unit and the neural network module can all be referred to the descriptions in the above embodiments, and will not be repeated here. The target neural network can be adopted... Figure 4 The method in the corresponding embodiment is automatically generated, or it can be generated by using... Figure 9 The method in the corresponding embodiment is automatically generated; the specific process of automatically generating the target neural network can be found in [reference needed]. Figure 4 or Figure 9 The description in the corresponding embodiment.
[0201] In this embodiment of the application, a method for the reasoning process of the target neural network is also provided, which expands the application scenarios of the present solution and improves the implementation flexibility of the present solution.
[0202] To provide a more intuitive understanding of this solution, the following demonstrates the beneficial effects of the embodiments of this application, based on actual experimental data. The first example shown is... Figure 4 The beneficial effects of the neural network acquisition method used in the corresponding embodiments are explained. Please refer to [link / reference]. Figure 11 , Figure 11 This is a schematic diagram illustrating the beneficial effects of the neural network acquisition method provided in the embodiments of this application. Figure 11 Taking the CIFAR-10 dataset as an example, Figure 11 The horizontal axis in the graph represents the duration. Figure 11 The vertical axis represents the error rate of the final target neural network when processing the target data.
[0203] like Figure 11 As shown, B1 represents the two curves generated during the process of generating the target neural network using the two existing methods, and B2 represents the curves generated using... Figure 4 A curve generated during the process of generating the target neural network using the method provided in the corresponding embodiment, compared with B1 and B2, shows that when the error rates of the obtained target neural networks are consistent, the following method is used: Figure 4 The method provided in the corresponding embodiment for generating the target neural network can significantly shorten the time spent on the entire process, and employs... Figure 4The method provided in the corresponding embodiment can obtain a target neural network with a lower error rate.
[0204] The next thing to be shown is... Figure 9 For the beneficial effects of the neural network acquisition method used in the corresponding embodiments, please refer to Table 1 below. Table 1 uses the experiment on the ImageNet16 dataset as an example.
[0205]
[0206] Table 1
[0207] Referring to Table 1 above, RSPS and GAEA DARTS are two existing methods for automatically generating target neural networks, 68.86 3.9 represents the error rate of the target neural network obtained using the RSPS method when processing the target data, which is 58.41%. 4.2 represents the error rate of the target neural network obtained using the GAEA DARTS method when processing the target data, 58.00. 2.9 represents the adoption Figure 9 The error rate of the target neural network obtained by the method provided in the corresponding embodiment when processing target data is shown in the third row of Table 1, which represents the time taken to obtain the target neural network using each method. The data in Table 1 shows that... Figure 9 The corresponding implementation not only requires fewer training epochs, but also yields a more efficient target neural network.
[0208] In Figure 1 to Figure 11 Based on the corresponding embodiments, in order to better implement the above-described solutions of this application, related equipment for implementing the above solutions is also provided below. See details. Figure 12 , Figure 12This is a schematic diagram of a neural network acquisition device provided in an embodiment of this application. The neural network acquisition device 1200 includes: an acquisition unit 1201, configured to acquire first indication information corresponding to a first neural architecture unit, the first indication information indicating the probability and / or frequency of each of k selectable neural network modules appearing in the first neural architecture unit, where k is a positive integer; a generation unit 1202, configured to generate a first neural architecture unit based on the first indication information and the k selectable neural network modules, and generate a first neural network based on the generated first neural architecture unit, the first neural network including at least one first neural architecture unit; the acquisition unit 1201 is further configured to acquire a target score corresponding to the first indication information, the target score indicating the performance of the first neural network corresponding to the first indication information in processing target data; the acquisition unit 1201 is further configured to acquire second indication information from multiple first indication information based on multiple target scores corresponding to multiple first indication information, and acquire a target neural network corresponding to the second indication information.
[0209] In one possible design, the first indication information is included in the Dirichlet distribution space.
[0210] In one possible design, the acquisition unit 1201 is further configured to acquire new first indication information based on the first indication information and the target score corresponding to the first indication information, wherein the new first indication information is used to indicate the probability of each of the k candidate neural network modules appearing in the first neural architecture unit, and the new first indication information is used to generate a new first neural network.
[0211] In one possible design, please refer to Figure 13 , Figure 13This is another schematic diagram of the neural network acquisition device provided in the embodiments of this application. The first indication information includes k first probability values corresponding to k candidate neural network modules. Each first probability value indicates the probability of a candidate neural network module appearing in a first neural architecture unit. The generation unit 1202 specifically includes: a product module 12021, used to multiply each first probability value by N to obtain a target result, the target result including k first values; a rounding module 12022, used to round each first value in the target result to obtain a rounded target result, wherein the rounded target result includes k second values, all of which are integers and the sum of the k second values is N, each second value indicating the number of times a candidate neural network module appears in the first neural architecture unit; and a generation module 12023, used to generate a first neural architecture unit based on the rounded target result and the k candidate neural network modules, wherein the N neural network modules included in the first neural architecture unit satisfy the constraints of the rounded target result, and N is a positive integer.
[0212] In one possible design, the generation unit 1202 is specifically used to obtain N first neural network modules based on k candidate neural network modules according to the first indication information, and generate a first neural architecture unit based on the N first neural network modules, wherein the first indication information is used to indicate the probability that each candidate neural network module is sampled; the first neural architecture unit includes N first neural network modules.
[0213] In one possible design, the target data is any of the following: image, speech, text, or sequence data.
[0214] It should be noted that the information interaction and execution process between the modules / units in the neural network acquisition device 1200 are based on the same concept as the above-mentioned method embodiments in this application. For details, please refer to the description in the method embodiments shown above in this application, which will not be repeated here.
[0215] This application also provides a neural network acquisition device, see embodiments thereof. Figure 14 , Figure 14This is a schematic diagram of a neural network acquisition device provided in an embodiment of this application. The neural network acquisition device 1400 includes: an acquisition unit 1401, used to acquire first indication information corresponding to a second neural architecture unit, wherein the second neural architecture unit includes N second neural network modules, each second neural network module is obtained by weighted summation of k neural network modules to be processed, and the first indication information is used to indicate the weight of each neural network module to be processed in the second neural network module, where N is an integer greater than or equal to 11; a generation unit 1402, used to generate a second neural architecture unit based on the first indication information and the k neural network modules to be processed, and generate a second neural network based on the generated second neural architecture unit, wherein the second neural network includes at least one second neural architecture unit; a training unit 1403, used to train the second neural network to update the first indication information until a preset condition is met to obtain updated first indication information; and a generation unit 1402, used to generate a first neural architecture unit based on the updated first indication information and the k neural network modules to be processed, and generate a target neural network based on the generated first neural architecture unit, wherein the updated first indication information is used to indicate the probability of each neural network module to be processed appearing in the first neural architecture unit, and the target neural network includes at least one first neural architecture unit.
[0216] In one possible design, the first indication information is included in the Dirichlet distribution space.
[0217] It should be noted that the information interaction and execution process between the modules / units in the neural network acquisition device 1400 are based on the same concept as the above-mentioned method embodiments in this application. For details, please refer to the description in the method embodiments shown above in this application, which will not be repeated here.
[0218] This application also provides a data processing apparatus, see below. Figure 15 , Figure 15 This is a schematic diagram of a data processing apparatus provided in an embodiment of this application. The data processing apparatus 1500 includes: an input unit 1501 for inputting target data into a target neural network; and a processing unit 1502 for processing the target data through the target neural network to obtain a prediction result corresponding to the target data. The target neural network includes at least one first neural architecture unit, which is obtained based on first indication information and k neural network modules to be processed. The first indication information is used to indicate the probability and / or frequency of each neural network module appearing in the first neural architecture unit among the k neural network modules to be processed, where k is a positive integer.
[0219] In one possible design, the first indication information is included in the Dirichlet distribution space.
[0220] It should be noted that the information interaction and execution process between the modules / units in the data processing device 1500 are based on the same concept as the above-mentioned method embodiments in this application. For details, please refer to the description in the method embodiments shown above in this application, which will not be repeated here.
[0221] The following describes a network device provided in an embodiment of this application. Please refer to [link / reference]. Figure 16 , Figure 16 This is a schematic diagram of a network device provided in an embodiment of this application. Specifically, the network device 1600 is implemented by one or more servers. The network device 1600 can vary significantly due to different configurations or performance. It may include one or more central processing units (CPUs) 1622 (e.g., one or more processors) and memory 1632, and one or more storage media 1630 (e.g., one or more mass storage devices) for storing application programs 1642 or data 1644. The memory 1632 and storage media 1630 can be temporary or persistent storage. The program stored in the storage media 1630 may include one or more modules (not shown in the diagram), each module may include a series of instruction operations on the network device. Furthermore, the CPU 1622 may be configured to communicate with the storage media 1630 and execute the series of instruction operations in the storage media 1630 on the network device 1600.
[0222] The network device 1600 may also include one or more power supplies 1626, one or more wired or wireless network interfaces 1650, one or more input / output interfaces 1658, and / or one or more operating systems 1641, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.
[0223] In one embodiment of this application, the network device 1600 is configured with Figure 12 or Figure 13 In the corresponding embodiment, the neural network acquisition device 1200, the central processing unit 1622 is used to execute... Figure 4 The method for acquiring a neural network executed by the network device in the corresponding embodiment. It should be noted that the specific manner in which the central processing unit 1622 executes the above steps differs from that in this application. Figure 4 The various method embodiments are based on the same concept, and the technical effects they bring are the same as those in this application. Figure 4 The corresponding method embodiments are the same, and for details, please refer to the description in the method embodiments shown above in this application, which will not be repeated here.
[0224] In another scenario, network device 1600 is configured with Figure 14 In the corresponding embodiment, the neural network acquisition device 1200, the central processing unit 1622 is used to execute... Figure 9 The method for acquiring a neural network executed by the network device in the corresponding embodiment. It should be noted that the specific manner in which the central processing unit 1622 executes the above steps differs from that in this application. Figure 9 The various method embodiments are based on the same concept, and the technical effects they bring are the same as those in this application. Figure 9 The corresponding method embodiments are the same, and for details, please refer to the description in the method embodiments shown above in this application, which will not be repeated here.
[0225] This application also provides an execution device; please refer to [link to relevant documentation]. Figure 17 , Figure 17 This is a schematic diagram of an execution device provided in an embodiment of this application. The execution device 1700 can specifically be a virtual reality (VR) device, a mobile phone, a tablet, a laptop, a smart robot, a smart home device, a smart wearable device, a monitoring data processing device, or a radar data processing device, etc., and is not limited thereto. Specifically, the execution device 1700 includes: a receiver 1701, a transmitter 1702, a processor 1703, and a memory 1704 (wherein the execution device 1700 may have one or more processors 1703). Figure 17 (Taking a processor as an example), processor 1703 may include application processor 17031 and communication processor 17032. In some embodiments of this application, receiver 1701, transmitter 1702, processor 1703 and memory 1704 may be connected via a bus or other means.
[0226] Memory 1704 may include read-only memory and random access memory, and provides instructions and data to processor 1703. A portion of memory 1704 may also include non-volatile random access memory (NVRAM). Memory 1704 stores processor and operation instructions, executable modules, or data structures, or subsets thereof, or extended sets thereof, wherein the operation instructions may include various operation instructions for implementing various operations.
[0227] Processor 1703 controls the operation of the execution device. In specific applications, the various components of the execution device are coupled together through a bus system, which may include not only the data bus, but also power buses, control buses, and status signal buses. However, for clarity, all buses are referred to as the bus system in the diagram.
[0228] The methods disclosed in the embodiments of this application can be applied to or implemented by processor 1703. Processor 1703 can be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above methods can be completed by integrated logic circuits in the hardware of processor 1703 or by instructions in software form. Processor 1703 can be a general-purpose processor, a digital signal processor (DSP), a microprocessor, or a microcontroller, and may further include application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. Processor 1703 can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module can reside in a mature storage medium in the field, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory 1704. Processor 1703 reads the information in memory 1704 and, in conjunction with its hardware, completes the steps of the above method.
[0229] Receiver 1701 can be used to receive input digital or character information, and to generate signal inputs related to the settings and function control of the execution device. Transmitter 1702 can be used to output digital or character information through the first interface; transmitter 1702 can also be used to send instructions to the disk group through the first interface to modify the data in the disk group; transmitter 1702 may also include a display device such as a display screen.
[0230] In this embodiment of the application, the execution device 1700 may be deployed with Figure 15 Corresponding to the data processing apparatus 1500 described in the embodiment, the application processor 17031 in the processor 1703 is used to execute Figure 9 The neural network processing method executed by the execution device in the corresponding embodiment. It should be noted that the specific manner in which the application processor 17031 executes the above steps differs from that in this application. Figure 10 The various method embodiments are based on the same concept, and the technical effects they bring are the same as those in this application. Figure 10The corresponding method embodiments are the same, and for details, please refer to the description in the method embodiments shown above in this application, which will not be repeated here.
[0231] This application also provides a computer program product that, when run on a computer, causes the computer to perform the aforementioned actions. Figure 10 The method described in the illustrated embodiment executes steps performed by the execution device, or causes the computer to perform the steps as described above. Figure 4 The steps performed by the network device in the method described in the illustrated embodiment, or causing the computer to perform the steps as described above. Figure 9 The steps performed by the network device in the method described in the illustrated embodiment.
[0232] This application embodiment also provides a computer-readable storage medium storing a program for performing signal processing, which, when run on a computer, causes the computer to perform the aforementioned actions. Figure 10 The method described in the illustrated embodiment executes steps performed by the execution device, or causes the computer to perform the steps as described above. Figure 4 The steps performed by the network device in the method described in the illustrated embodiment, or causing the computer to perform the steps as described above. Figure 9 The steps performed by the network device in the method described in the illustrated embodiment.
[0233] The neural network acquisition device, data processing device, execution device, and network device provided in this application embodiment can specifically be a chip. The chip includes a processing unit and a communication unit. The processing unit can be, for example, a processor, and the communication unit can be, for example, an input / output interface, pins, or circuits. The processing unit can execute computer execution instructions stored in the storage unit to cause the chip to perform the aforementioned operations. Figure 10 The data processing method described in the illustrated embodiment, or, to cause the chip to perform the above... Figure 4 The method for obtaining the neural network described in the illustrated embodiment, or, to cause the chip to perform the above... Figure 9 The embodiment described herein illustrates a method for obtaining a neural network. Optionally, the storage unit is a storage unit within the chip, such as a register or cache. Alternatively, the storage unit can be a storage unit located outside the chip within the wireless access device, such as a read-only memory (ROM) or other types of static storage devices capable of storing static information and instructions, such as random access memory (RAM).
[0234] For details, please refer to Figure 18 , Figure 18This is a schematic diagram of a chip provided in an embodiment of this application. The chip can be represented as a neural network processor (NPU) 180. The NPU 180 is mounted as a coprocessor on the host CPU, and tasks are assigned by the host CPU. The core part of the NPU is the arithmetic circuit 1803, which is controlled by the controller 1804 to extract matrix data from the memory and perform multiplication operations.
[0235] In some implementations, the arithmetic circuit 1803 internally includes multiple processing engines (PEs). In some implementations, the arithmetic circuit 1803 is a two-dimensional pulsating array. The arithmetic circuit 1803 can also be a one-dimensional pulsating array or other electronic circuitry capable of performing mathematical operations such as multiplication and addition. In some implementations, the arithmetic circuit 1803 is a general-purpose matrix processor.
[0236] For example, suppose we have an input matrix A, a weight matrix B, and an output matrix C. The arithmetic circuit retrieves the corresponding data of matrix B from the weight memory 1802 and caches it in each PE of the arithmetic circuit. The arithmetic circuit retrieves the data of matrix A from the input memory 1801 and performs matrix operations with matrix B. The partial result or the final result of the obtained matrix is stored in the accumulator 1807.
[0237] Unified memory 1806 is used to store input and output data. Weight data is directly transferred to weight memory 1802 via Direct Memory Access Controller (DMAC) 1805. Input data is also transferred to unified memory 1806 via DMAC.
[0238] BIU stands for Bus Interface Unit, which is used for interaction between the AXI bus and the DMAC and the Instruction Fetch Buffer (IFB) 1808.
[0239] The Bus Interface Unit (BIU) 1810 is used by the instruction fetch memory 1808 to fetch instructions from external memory, and also by the memory access controller 1805 to fetch the original data of the input matrix A or the weight matrix B from external memory.
[0240] The DMAC is mainly used to move input data from external memory DDR to unified memory 1806, or to weight data to weight memory 1802, or to input data to input memory 1801.
[0241] The vector computation unit 1807 includes multiple processing units that further process the output of the computation circuits as needed, such as vector multiplication, vector addition, exponential operations, logarithmic operations, size comparisons, etc. It is primarily used for computations in non-convolutional / fully connected layers of neural networks, such as batch normalization, pixel-level summation, and upsampling of feature planes.
[0242] In some implementations, the vector computation unit 1807 can store the processed output vector in the unified memory 1806. For example, the vector computation unit 1807 can apply linear and / or nonlinear functions to the output of the computation circuit 1803, such as performing linear interpolation on feature planes extracted by convolutional layers, or accumulating a vector of values to generate activation values. In some implementations, the vector computation unit 1807 generates normalized values, pixel-level summed values, or both. In some implementations, the processed output vector can be used as activation input to the computation circuit 1803, for example, for use in subsequent layers of the neural network.
[0243] The instruction fetch buffer 1808 connected to the controller 1804 is used to store the instructions used by the controller 1804;
[0244] The unified memory 1806, input memory 1801, weighted memory 1802, and instruction fetch memory 1808 are all on-chip memories. External memory is proprietary to this NPU hardware architecture.
[0245] in, Figures 4 to 10 The operations of each layer in the first neural network, the second neural network, and the target neural network shown can be performed by the operation circuit 1803 or the vector calculation unit 1807.
[0246] The processor mentioned above can be a general-purpose central processing unit, a microprocessor, an ASIC, or one or more integrated circuits used to control the execution of a program in the first aspect of the method.
[0247] It should also be noted that the device embodiments described above are merely illustrative. 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; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. In addition, in the device embodiment drawings provided in this application, the connection relationship between modules indicates that they have a communication connection, which can be implemented as one or more communication buses or signal lines.
[0248] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware, or it can be implemented by special-purpose hardware including application-specific integrated circuits, special-purpose CPUs, special-purpose memory, special-purpose components, etc. Generally, any function performed by a computer program can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be diverse, such as analog circuits, digital circuits, or special-purpose circuits. However, for this application, software program implementation is more often the preferred implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a readable storage medium, such as a computer floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk, or optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, network device, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0249] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product.
[0250] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, network device, or data center to another website, computer, network device, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a network device or data center that integrates one or more available media. The available medium may be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state disk (SSD)).
Claims
1. A method for obtaining a neural network, characterized in that, The method comprises: obtaining first indication information corresponding to a first neural architecture unit, the first indication information being used to indicate a probability and / or a number of times that each of k to-be-selected neural network modules appears in the first neural architecture unit, the first neural architecture unit comprising N neural network modules in the k to-be-selected neural network modules, the N being a positive integer, and the k being a positive integer; generating the first neural architecture unit according to the first indication information and the k to-be-selected neural network modules, and generating a first neural network according to the generated first neural architecture unit, the first neural network comprising at least one first neural architecture unit; obtaining a target score corresponding to the first indication information, the target score being used to indicate a performance of the first neural network corresponding to the first indication information when processing target data, the target data being any one of an image, a voice or a text; obtaining second indication information from the multiple first indication information according to multiple target scores corresponding to the multiple first indication information, and obtaining a target neural network corresponding to the second indication information.
2. The method of claim 1, wherein, The first indication information is included in a Dirichlet distribution space.
3. The method of claim 2, wherein, After the target score corresponding to the first indication information is obtained, the method further comprises: obtaining new first indication information according to the first indication information and the target score corresponding to the first indication information, wherein the new first indication information is used to indicate a probability that each of the k to-be-selected neural network modules appears in the first neural architecture unit, and the new first indication information is used to generate a new first neural network.
4. The method of claim 2, wherein, The first indication information comprises k first probability values corresponding to the k to-be-selected neural network modules, one first probability value being used to indicate a probability that one to-be-selected neural network module appears in the first neural architecture unit, and the generating the first neural architecture unit according to the first indication information and the k to-be-selected neural network modules comprises: multiplying each first probability value and the N to obtain a target result, the target result comprising k first values; performing rounding processing on each first value in the target result to obtain a rounded target result, wherein the rounded target result comprises k second values, the k second values are all integers, and a sum of the k second values is the N, one second value being used to indicate a number of times that one to-be-selected neural network module appears in the first neural architecture unit; generating the first neural architecture unit according to the rounded target result and the k to-be-selected neural network modules, wherein the N neural network modules comprised by the first neural architecture unit satisfy a constraint of the rounded target result, and the N is a positive integer.
5. The method according to any one of claims 1 to 4, characterized in that, The generating the first neural architecture unit according to the first indication information and the k to-be-selected neural network modules comprises: According to the first indication information, N first neural network modules are sampled based on the k neural network modules to be selected, and the first indication information is used to indicate a probability of each of the neural network modules to be selected being sampled. According to the N first neural network modules, the first neural architecture unit is generated, and the first neural architecture unit includes the N first neural network modules.
6. A method of obtaining a neural network, the method comprising: The method comprises: obtaining first indication information corresponding to a second neural architecture unit, the second neural architecture unit including N second neural network modules, each of the second neural network modules being obtained by weighted summation of k neural network modules to be processed, the first indication information being used to indicate a weight of each of the neural network modules to be processed in the second neural network module, N being an integer greater than or equal to 1; generating the second neural architecture unit according to the first indication information and the k neural network modules to be processed, and generating a second neural network according to the generated second neural architecture unit, the second neural network including at least one second neural architecture unit; training the second neural network to update the first indication information until a preset condition is met, to obtain updated first indication information; generating a first neural architecture unit according to the updated first indication information and the k neural network modules to be processed, and generating a target neural network according to the generated first neural architecture unit, wherein the updated first indication information is used to indicate a probability of each of the neural network modules to be processed appearing in the first neural architecture unit, the target neural network includes at least one first neural architecture unit, and the target neural network is used to process target data, the target data being any one of an image, a voice or a text.
7. The method of claim 6, wherein, The first indication information is included in a Dirichlet distribution space.
8. A data processing method, characterized by, The method comprises: inputting target data into a target neural network, the target data being any one of an image, a voice or a text; processing the target data by the target neural network to obtain a prediction result corresponding to the target data, wherein the target neural network includes at least one first neural architecture unit, the first neural architecture unit being obtained according to first indication information and k neural network modules to be processed, the first indication information being used to indicate a probability and / or a number of times of each of the k neural network modules to be processed appearing in the first neural architecture unit, the first neural architecture unit including N neural network modules of the k neural network modules to be selected, N being a positive integer, and k being a positive integer.
9. The method of claim 8, wherein, The first indication information is included in a Dirichlet distribution space.
10. An acquisition apparatus of a neural network, characterized by, The device comprises: The acquisition unit is configured to acquire first indication information corresponding to a first neural architecture unit, the first indication information being used to indicate a probability and / or a number of times that each to-be-selected neural network module in k to-be-selected neural network modules appears in the first neural architecture unit, the first neural architecture unit including N neural network modules in the k to-be-selected neural network modules, the N being a positive integer, and the k being a positive integer. The generation unit is configured to generate the first neural architecture unit according to the first indication information and the k to-be-selected neural network modules, and generate a first neural network according to the generated first neural architecture unit, the first neural network including at least one first neural architecture unit. The acquisition unit is further configured to acquire a target score corresponding to the first indication information, the target score being used to indicate a performance of the first neural network corresponding to the first indication information when processing target data, the target data being any one of an image, a voice, or a text. The acquisition unit is further configured to acquire second indication information from the multiple first indication information according to multiple target scores corresponding to the multiple first indication information, and acquire a target neural network corresponding to the second indication information.
11. The apparatus of claim 10, wherein, The first indication information is included in a Dirichlet distribution space.
12. The apparatus of claim 11, wherein, The acquisition unit is further configured to acquire new first indication information according to the first indication information and the target score corresponding to the first indication information, the new first indication information being used to indicate a probability of each to-be-selected neural network module in the k to-be-selected neural network modules appearing in the first neural architecture unit, and the new first indication information being used to generate a new first neural network.
13. The apparatus of claim 11, wherein, The first indication information includes k first probability values corresponding to the k to-be-selected neural network modules, one first probability value being used to indicate a probability of one to-be-selected neural network module appearing in the first neural architecture unit, and the generation unit specifically includes: A product module configured to multiply each first probability value and the N to obtain a target result, the target result including k first values. A rounding module configured to perform rounding processing on each first value in the target result to obtain a rounded target result, the rounded target result including k second values, the k second values all being integers and a sum of the k second values being the N, and one second value being used to indicate a number of times that one to-be-selected neural network module appears in the first neural architecture unit. A generation module configured to generate the first neural architecture unit according to the rounded target result and the k to-be-selected neural network modules, wherein the N neural network modules included in the first neural architecture unit satisfy a constraint of the rounded target result, and the N is a positive integer.
14. The apparatus of any one of claims 10 to 13, wherein, The generation unit is specifically configured to sample N first neural network modules based on the k neural network modules to be selected according to the first indication information, and generate the first neural architecture unit according to the N first neural network modules, wherein the first indication information is used to indicate a probability of sampling each neural network module to be selected.
15. An acquisition apparatus of a neural network, characterized by comprising: The device comprises: The acquisition unit is configured to acquire first indication information corresponding to a second neural architecture unit, the second neural architecture unit comprising N second neural network modules, each second neural network module being obtained by weighted summation of k neural network modules to be processed, the first indication information being used to indicate a weight of each neural network module to be processed in the second neural network module, N being an integer greater than or equal to 1; The generation unit is configured to generate the second neural architecture unit according to the first indication information and the k neural network modules to be processed, and generate a second neural network according to the generated second neural architecture unit, the second neural network comprising at least one second neural architecture unit; The training unit is configured to train the second neural network to update the first indication information until a preset condition is met, to obtain updated first indication information; The generation unit is configured to generate a first neural architecture unit according to the updated first indication information and the k neural network modules to be processed, and generate a target neural network according to the generated first neural architecture unit, wherein the updated first indication information is used to indicate a probability of occurrence of each neural network module to be processed in the first neural architecture unit, the target neural network comprising at least one first neural architecture unit, and the target neural network being used to process target data, the target data being any one of an image, a voice, or a text.
16. The apparatus of claim 15, wherein, The first indication information is included in a Dirichlet distribution space.
17. A data processing apparatus, characterized by: The device comprises: The input unit is configured to input target data into a target neural network, the target data being any one of an image, a voice, or a text; The processing unit is configured to process the target data by the target neural network to obtain a prediction result corresponding to the target data, wherein the target neural network comprises at least one first neural architecture unit, the first neural architecture unit being obtained according to first indication information and k neural network modules to be processed, the first indication information being used to indicate a probability and / or a number of occurrences of each neural network module in the k neural network modules to be processed in the first neural architecture unit, the first neural architecture unit comprising N neural network modules in the k neural network modules to be selected, N being a positive integer, and k being a positive integer.
18. The apparatus of claim 17, wherein, The first indication information is included in a Dirichlet distribution space.
19. A computer program product, characterised in that, The computer program product comprises a computer program which, when executed by a computer, causes the computer to perform the method according to any one of claims 1 to 5, or causes the computer to perform the method according to claim 6 or 7, or causes the computer to perform the method according to claim 8 or 9.
20. A computer-readable storage medium, characterized in that, The computer program product comprises a computer program which, when executed by a computer, causes the computer to perform the method according to any one of claims 1 to 5, or causes the computer to perform the method according to claim 6 or 7, or causes the computer to perform the method according to claim 8 or 9.
21. A network device, comprising: The network device comprises a processor and a memory, The memory is configured to store a program; The processor is configured to execute the program in the memory, so that the network device performs the method according to any one of claims 1 to 5, or so that the network device performs the method according to claim 6 or 7.
22. An execution device, comprising: The network device comprises a processor and a memory, The memory is configured to store a program; The processor is configured to execute the program in the memory, so that the network device performs the method according to any one of claims 1 to 5, or so that the network device performs the method according to claim 6 or 7. The network device comprises a processor and a memory, The memory is configured to store a program; The processor is configured to execute the program in the memory, so that the network device performs the method according to any one of claims 1 to 5, or so that the network device performs the method according to claim 6 or 7.
Citation Information
Patent Citations
Neural network structure determination method and device
CN111950702A
Neural architecture search with weight sharing
WO2021195095A1
Deep- reinforcement learning (RL), weight-resonant system and method for fixed-horizon search of optimality
WO2022147584A2