Training method, device and storage medium of network structure optimizer of neural network
The network structure optimizer performs feature extraction and prediction optimization on the neural network, removes redundant computing units, optimizes the network structure, solves the redundant computing problem in the neural network, improves model performance and saves computing costs.
Patent Information
- Application Number
- CN201911023909.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-10-25
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2039-10-31
AI Technical Summary
There are redundant computing units or computing operations in the network structure of neural networks, which increases computing costs and reduces model performance.
The network structure optimizer is used to extract features of the network structure of the neural network, predict optimization methods, update the structure and perform performance evaluation, remove redundant computing units or operations, and optimize the network structure.
It significantly improves the performance of the neural network model, saves computing costs, and is suitable for various application scenarios.
Smart Images

Figure CN110782015B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to artificial intelligence technology, and in particular to a training method, device, electronic equipment and storage medium for a network structure optimizer of a neural network. Background Art
[0002] Artificial Intelligence (AI) is a comprehensive technology in computer science. By studying the design principles and implementation methods of various intelligent machines, machines are given the functions of perception, reasoning and decision-making. Artificial intelligence technology is an interdisciplinary subject that covers a wide range of fields, such as natural language processing technology and machine learning / deep learning. With the development of technology, artificial intelligence technology will be applied in more fields and play an increasingly important role.
[0003] Neural networks have attracted widespread attention from academia and industry, and have achieved breakthrough results in many application fields, including image recognition, object detection, semantic segmentation, speech recognition, and natural language processing.
[0004] However, there are some redundant computing units or computing operations in the network structure of neural networks, and these redundancies will increase the computing cost. Summary of the invention
[0005] The embodiments of the present invention provide a training method, device, electronic device and storage medium for a network structure optimizer of a neural network, which can optimize the network structure of the neural network according to the network structure optimizer and save computing costs.
[0006] The technical solution of the embodiment of the present invention is achieved as follows:
[0007] An embodiment of the present invention provides a training method for a network structure optimizer of a neural network, the method comprising:
[0008] Extracting features of the network structure of the neural network by the network structure optimizer to obtain feature information corresponding to the network structure;
[0009] Predicting the characteristic information by the network structure optimizer to determine a plurality of optimization methods for the network structure;
[0010] The network structure of the neural network is updated according to the optimization method for the network structure to obtain an optimized network structure;
[0011] A performance evaluation is performed on the optimized network structure, and parameters of the network structure optimizer are updated according to the evaluation results.
[0012] An embodiment of the present invention provides a method for optimizing the network structure of a neural network, which is applied to a network structure optimizer of the neural network;
[0013] The method comprises:
[0014] Extracting features of the network structure of the neural network by the network structure optimizer to obtain feature information corresponding to the network structure;
[0015] Predicting the characteristic information by the network structure optimizer to determine an optimization method for the network structure;
[0016] The network structure of the neural network is updated according to the optimization method for the network structure to obtain an optimized network structure.
[0017] An embodiment of the present invention provides a training device for a network structure optimizer of a neural network, the device comprising:
[0018] A first extraction module, used to extract features from the network structure of the neural network through the network structure optimizer to obtain feature information corresponding to the network structure;
[0019] A first prediction module, used to predict the characteristic information through the network structure optimizer, and determine multiple optimization methods for the network structure;
[0020] A first optimization module, used to update the network structure of the neural network according to the optimization method for the network structure to obtain an optimized network structure;
[0021] The training module is used to perform performance evaluation on the optimized network structure and update the parameters of the network structure optimizer according to the evaluation results.
[0022] In the above technical solution, the first extraction module is also used to establish a directed graph of the network structure of the neural network through the network structure optimizer;
[0023] Feature extraction is performed on the directed graph to obtain feature information corresponding to the network structure.
[0024] In the above technical solution, the first extraction module is also used to perform sampling processing on the network structure of the neural network through the network structure optimizer to obtain network layer information for the network structure;
[0025] A directed graph for the network structure is established according to the network layer information.
[0026] In the above technical solution, the first extraction module is further used to determine the input features or output features in the network layer information as node information in a directed graph;
[0027] Determining the operation information in the network layer information as edge information in the directed graph;
[0028] Establishing a directed graph for the network structure according to the node information and the edge information;
[0029] The operation information includes at least one of the following: a convolution operation, a jump connection operation, a pooling operation, and a null connection operation.
[0030] In the above technical solution, the first extraction module is also used to determine the node information and edge information in the directed graph;
[0031] According to the parameters in the graph convolutional network, the matrix, the activation function, the node information and the edge information can be learned to determine the feature information corresponding to the network structure.
[0032] In the above technical solution, the first extraction module is further used to multiply the edge information, the node information, and the parameter learnable matrix in the first layer of the graph convolutional network to obtain the output of the first layer of the graph convolutional network;
[0033] Performing a nonlinear transformation on the output of the first-layer graph convolutional network through an activation function in the graph convolutional network to obtain a transformed output of the first-layer graph convolutional network;
[0034] The output of the first-layer graph convolutional network after the transformation and the parameter learnable matrix in the second-layer graph convolutional network are multiplied to obtain the output of the second-layer graph convolutional network;
[0035] The output of the second-layer graph convolutional network, the side information, and the parameter learning matrix of the fully connected layer in the graph convolutional network are multiplied to obtain feature information corresponding to the network structure.
[0036] In the above technical solution, the first prediction module is further used to classify the feature information through the network structure optimizer to determine the probability of the optimization method corresponding to the network structure;
[0037] According to the probability of the optimization method of the network structure, an optimization method for the network structure that meets the probability requirement is determined among the multiple optimization methods.
[0038] In the above technical solution, the first optimization module is also used to determine the operation information, the size of the network layer and the number of network layers in the optimization method;
[0039] Replacing the operation information, the size of the network layer, and the number of network layers in the network structure of the neural network with the operation information, the size of the network layer, and the number of network layers in the optimization method to obtain an optimized network structure;
[0040] The size of the network layer includes at least one of the following: the size of the convolution kernel and the size of the pooling layer.
[0041] In the above technical solution, the training module is also used to respectively visualize the optimized network structure and the network structure of the neural network to obtain visualization results corresponding to the optimized network structure and the network structure of the neural network;
[0042] In response to the adjustment operation corresponding to the visualization result, the parameters of the network structure optimizer are updated.
[0043] In the above technical solution, the training module is also used to determine the accuracy of the optimized network structure relative to the network structure of the neural network based on the optimized network structure and the network structure of the neural network;
[0044] Based on the accuracy, construct a loss function of the network structure optimizer;
[0045] The parameters of the network structure optimizer are updated until the loss function converges.
[0046] An embodiment of the present invention provides a device for optimizing the network structure of a neural network, the device comprising:
[0047] A second extraction module is used to extract features of the network structure of the neural network through the network structure optimizer to obtain feature information corresponding to the network structure;
[0048] A second prediction module, used to predict the characteristic information through the network structure optimizer and determine an optimization method for the network structure;
[0049] The second optimization module is used to update the network structure of the neural network according to the optimization method for the network structure to obtain an optimized network structure.
[0050] In the above technical solution, the second extraction module is also used to establish a directed graph of the network structure of the neural network through the network structure optimizer;
[0051] Feature extraction is performed on the directed graph to obtain feature information corresponding to the network structure.
[0052] In the above technical solution, the network structure optimizer is used to establish a directed graph of the network structure of the neural network, including:
[0053] The network structure of the neural network is sampled and processed by the network structure optimizer to obtain network layer information for the network structure;
[0054] A directed graph for the network structure is established according to the network layer information.
[0055] In the above technical solution, the root second extraction module is also used to determine the input features or output features in the network layer information as node information in a directed graph;
[0056] Determining the operation information in the network layer information as edge information in the directed graph;
[0057] Establishing a directed graph for the network structure according to the node information and the edge information;
[0058] The operation information includes at least one of the following: a convolution operation, a jump connection operation, a pooling operation, and a null connection operation.
[0059] In the above technical solution, the second extraction module is also used to determine the node information and edge information in the directed graph;
[0060] According to the parameters in the graph convolutional network, the matrix, the activation function, the node information and the edge information can be learned to determine the feature information corresponding to the network structure.
[0061] In the above technical solution, the second extraction module is further used to multiply the edge information, the node information, and the parameter learnable matrix in the first layer of the graph convolutional network to obtain the output of the first layer of the graph convolutional network;
[0062] Performing a nonlinear transformation on the output of the first-layer graph convolutional network through an activation function in the graph convolutional network to obtain a transformed output of the first-layer graph convolutional network;
[0063] The output of the first-layer graph convolutional network after the transformation and the parameter learnable matrix in the second-layer graph convolutional network are multiplied to obtain the output of the second-layer graph convolutional network;
[0064] The output of the second-layer graph convolutional network, the side information, and the parameter learning matrix of the fully connected layer in the graph convolutional network are multiplied to obtain feature information corresponding to the network structure.
[0065] In the above technical solution, the second prediction module is further used to classify the feature information through the network structure optimizer to determine the probability of the optimization method corresponding to the network structure;
[0066] According to the probability of the optimization method of the network structure, an optimization method for the network structure that meets the probability requirement is determined among the multiple optimization methods.
[0067] In the above technical solution, the second optimization module is also used to determine the operation information, the size of the network layer and the number of network layers in the optimization method;
[0068] Replacing the operation information, the size of the network layer, and the number of network layers in the network structure of the neural network with the operation information, the size of the network layer, and the number of network layers in the optimization method to obtain an optimized network structure;
[0069] The size of the network layer includes at least one of the following: the size of the convolution kernel and the size of the pooling layer.
[0070] An embodiment of the present invention provides a training device for a network structure optimizer of a neural network, the device comprising:
[0071] A memory for storing executable instructions;
[0072] The processor is used to implement the training method of the network structure optimizer of the neural network provided by the embodiment of the present invention when executing the executable instructions stored in the memory.
[0073] An embodiment of the present invention provides a device for optimizing the network structure of a neural network, the device comprising:
[0074] A memory for storing executable instructions;
[0075] The processor is used to implement the method for optimizing the network structure of the neural network provided by the embodiment of the present invention when executing the executable instructions stored in the memory.
[0076] An embodiment of the present invention provides a storage medium storing executable instructions for causing a processor to execute instructions to implement a training method for a network structure optimizer of a neural network provided by an embodiment of the present invention, or to implement a method for optimizing a network structure of a neural network provided by an embodiment of the present invention.
[0077] The embodiments of the present invention have the following beneficial effects:
[0078] The network structure optimizer predicts feature information, determines the optimization method for the network structure, and optimizes the network structure according to the optimization method. Any input network structure can be optimized; redundant computing units or computing operations in the network structure are removed, thereby saving subsequent computing power; the neural network model significantly improves model performance based on the optimized network structure and is suitable for various application scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0079] Figure 1 1 is a schematic diagram of an application scenario of a training system 10 for a network structure optimizer of a neural network provided in an embodiment of the present invention;
[0080] Figure 2 It is a structural schematic diagram of a training device 500 of a network structure optimizer of a neural network provided in an embodiment of the present invention;
[0081] Figure 3A-3B It is a flow chart of a training method of a network structure optimizer of a neural network provided by an embodiment of the present invention;
[0082] Figure 4 is a schematic diagram of the structure of a device 600 for optimizing the network structure of a neural network provided by an embodiment of the present invention;
[0083] Figure 5 It is a schematic flow chart of a method for optimizing the network structure of a neural network provided by an embodiment of the present invention;
[0084] Figure 6 is a structural diagram of a deep neural network with stacked convolutional layers provided by an embodiment of the present invention;
[0085] Figure 7 is a structural diagram of a deep neural network with additional connections provided by an embodiment of the present invention;
[0086] Figure 8 is a system block diagram of a NAS provided by an embodiment of the present invention;
[0087] Fig. 9 is a schematic diagram of a DAG structure in a neural network provided by an embodiment of the present invention;
[0088] Fig.10 is a comparative schematic diagram of network structure optimization provided by an embodiment of the present invention;
[0089] Fig.11 is a schematic diagram of the system structure provided by an embodiment of the present invention;
[0090] Fig.12 is a schematic diagram of a network structure provided by an embodiment of the present invention;
[0091] Fig.13is a schematic diagram of a directed graph representation corresponding to the network structure provided by an embodiment of the present invention;
[0092] Fig.14 is a schematic diagram of operation conversion rules in a network structure provided by an embodiment of the present invention;
[0093] Fig.15 is a schematic diagram of the process of the AutoML product provided by an embodiment of the present invention;
[0094] Fig.16 It is a directed graph representation and a network representation schematic diagram of a network structure of a computing module and a network structure of a downsampling module provided by an embodiment of the present invention;
[0095] Fig.17 It is a schematic diagram for visualizing the network structure of the computing module and the network structure of the downsampling module provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0096] In order to make the purpose, technical solutions and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present invention. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present invention.
[0097] In the following description, the terms "first\second" are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present invention described herein can be implemented in an order other than that illustrated or described herein.
[0098] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which the present invention belongs. The terms used herein are only for the purpose of describing the embodiments of the present invention and are not intended to limit the present invention.
[0099] Before further describing the embodiments of the present invention in detail, the nouns and terms involved in the embodiments of the present invention are described. The nouns and terms involved in the embodiments of the present invention are subject to the following interpretations.
[0100] 1) Image recognition: The technology of using computers to process, analyze and understand images to identify targets and objects of various different patterns is a practical application of deep learning algorithms. Image recognition technology is generally divided into face recognition and object recognition. Face recognition is mainly used in security inspections, identity verification and mobile payments; object recognition is mainly used in the circulation of goods, especially in unmanned retail fields such as unmanned shelves and smart retail cabinets.
[0101] 2) Target detection: also called target extraction, is a kind of image segmentation based on the geometric and statistical features of the target. It combines the segmentation and recognition of the target into one. Its accuracy and real-time performance are important capabilities of the entire system. Especially in complex scenes, when multiple targets need to be processed in real time, automatic target extraction and recognition are particularly important. With the development of computer technology and the widespread application of computer vision principles, the research on real-time tracking of targets using computer image processing technology is becoming more and more popular. Dynamic real-time tracking and positioning of targets has a wide range of application value in intelligent transportation systems, intelligent monitoring systems, and surgical instrument positioning in medical navigation surgery.
[0102] 3) Speech recognition: technology that allows machines to convert speech signals into corresponding text or commands through the process of recognition and understanding. Speech recognition technology mainly includes three aspects: feature extraction technology, pattern matching criteria and model training technology.
[0103] 4) Natural Language Processing (NLP): An important direction in the fields of computer science and artificial intelligence, which enables effective communication between humans and computers using natural language. Natural language processing is a science that integrates linguistics, computer science, and mathematics. Therefore, this field will involve natural language, which is the language people use in daily life, so it is closely related to linguistics. Natural language processing technology usually includes text processing, semantic understanding, machine translation, robot question answering, knowledge graph and other technologies.
[0104] 5) Machine Reading Comprehension (MRC): Given a document and a question, the machine predicts the answer to the question based on the document. For extractive machine reading comprehension, the answer is generally a fragment in a known document. The MRC model predicts the answer by predicting the position of the start and end words of the answer in the known document.
[0105] 6) Directed graph: To represent the relationship between objects, a directed graph can be represented by an ordered triple (V(D), A(D), ψD), where ψD is the association function, which is an ordered pair of elements in V(D) corresponding to each element in A(D).
[0106] 7) Graph Neural Network (GNN): A neural network that acts directly on the graph structure, mainly for processing data with non-Euclidean spatial structure (graph structure). It has the characteristics of ignoring the input order of nodes; during the calculation process, the representation of the node is affected by its surrounding neighboring nodes, while the connection of the graph itself remains unchanged; the representation of the graph structure enables graph-based reasoning. Usually, a graph neural network consists of two modules: a propagation module and an output module. The propagation module is used to transfer information between nodes in the graph and update the state, and the output module is used to define the objective function based on the vector representation of the nodes and edges of the graph according to different tasks. Graph neural networks include: Graph Convolutional Networks (GCNs), Gated Graph Neural Networks (GGNNs), and Graph Attention Networks (GAT) based on the attention mechanism.
[0107] The relevant data collection and processing in the embodiments of this application should be strictly in accordance with the requirements of relevant laws and regulations when applied in examples, obtain the informed consent or separate consent of the personal information subject, and carry out subsequent data use and processing within the scope of authorization of laws and regulations and the personal information subject.
[0108] The neural network described in the embodiment of the present invention can be applied to various fields, for example, it can be an image recognition neural network, a target detection neural network, a semantic segmentation neural network, a speech recognition neural network, etc., that is, the neural network in the embodiment of the present invention is not limited to a certain field.
[0109] In order to at least solve the above-mentioned technical problems of the related art, the embodiments of the present invention provide a training method, device, electronic device and storage medium of a network structure optimizer of a neural network, which can optimize the network structure of a neural network through a network structure optimizer to save computing costs. The following describes an exemplary application of a training device of a network structure optimizer of a neural network provided by an embodiment of the present invention. The training device of a network structure optimizer of a neural network provided by an embodiment of the present invention can be a server, such as a server deployed in the cloud, which optimizes the network structure of the neural network according to the network structure of the neural network provided by other devices or users, obtains an optimized network structure, and displays the optimized network structure to the user. For example, the server obtains the network structure of the neural network according to other devices, optimizes the network structure of the neural network through a network structure optimizer, and obtains an optimized network structure; it can also be a notebook computer, a tablet computer, a desktop computer, a mobile device (for example, a mobile phone, a personal digital assistant) and other types of user terminals, such as a handheld terminal, which obtains the optimized network structure according to the network structure of the neural network input by the user on the handheld terminal, and displays it on the display interface of the handheld terminal so that the user can understand the optimized network structure.
[0110] As an example, see Figure 1 , Figure 1 It is a schematic diagram of an application scenario of a training system 10 for a network structure optimizer of a neural network provided in an embodiment of the present invention. A terminal 200 is connected to a server 100 via a network 300. The network 300 may be a wide area network or a local area network, or a combination of the two.
[0111] Terminal 200 can be used to obtain the network structure of a neural network. For example, when a user inputs the network structure of a neural network through an input interface, after the input is completed, the terminal automatically obtains the network structure of the neural network input by the user.
[0112] In some embodiments, the terminal 200 locally executes the training method of the network structure optimizer of the neural network provided in the embodiment of the present invention to complete the network structure of the neural network input by the user to obtain an optimized network structure. For example, a network structure optimization assistant is installed on the terminal 200, and the user inputs the network structure of the neural network in the network structure optimization assistant. The terminal 200 optimizes the network structure according to the input network structure of the neural network through the network structure optimizer to obtain the optimized network structure, and displays the optimized network structure on the display interface 210 of the terminal 200, so that the user can perform applications such as image recognition, target detection, semantic segmentation, speech recognition and natural language processing according to the optimized network structure.
[0113] In some embodiments, the terminal 200 may also send the network structure of the neural network input by the user on the terminal 100 to the server 100 through the network 300, and call the training function of the network structure optimizer of the neural network provided by the server 100. The server 100 obtains the optimized network structure through the training method of the network structure optimizer of the neural network provided by the embodiment of the present invention. For example, a network structure optimization assistant is installed on the terminal 200, and the user inputs the network structure of the neural network in the network structure optimization assistant. The terminal sends the network structure of the neural network to the server 100 through the network 300. After receiving the network structure of the neural network, the server 100 optimizes the network structure of the neural network through the network structure optimizer to obtain the optimized network structure, and returns the optimized network structure to the network structure optimization assistant, and displays the optimized network structure on the display interface 210 of the terminal 200. Alternatively, the server 100 directly provides the optimized network structure so that the user can perform applications such as image recognition, target detection, semantic segmentation, speech recognition and natural language processing according to the optimized network structure.
[0114] In one implementation scenario, in order to improve the performance of image recognition, the server or terminal can determine multiple optimization methods for the network structure of the neural network for image recognition based on an input network structure of the neural network for image recognition, update the network structure of the neural network for image recognition according to the optimization method for the network structure to obtain an optimized network structure, perform a performance evaluation on the optimized network structure, and update the parameters of the network structure optimizer according to the evaluation results to obtain a trained network structure optimizer, so that the network structure of the neural network for image recognition can be subsequently optimized according to the trained network structure optimizer. The optimized network structure of the neural network for image recognition can reduce redundant computing units or computing operations and reduce computing costs, and can also improve the performance of a model based on the network structure, so that images can be accurately and quickly recognized.
[0115] In one implementation scenario, in order to improve the performance of target detection, the server or terminal can determine multiple optimization methods for the network structure of the neural network for target detection based on the input network structure of the neural network for target detection, update the network structure of the neural network for target detection according to the optimization method for the network structure to obtain an optimized network structure, perform a performance evaluation on the optimized network structure, and update the parameters of the network structure optimizer according to the evaluation results to obtain a trained network structure optimizer, so that the network structure of the neural network for target detection can be subsequently optimized according to the trained network structure optimizer. The optimized network structure of the neural network for target detection can reduce redundant computing units or computing operations and reduce computing costs, and can also improve the performance of a model based on the network structure, so that the target object can be detected accurately and quickly.
[0116] In one implementation scenario, in order to improve the performance of speech recognition, the server or terminal can determine multiple optimization methods for the network structure of the neural network for speech recognition based on the input network structure of the neural network for speech recognition, update the network structure of the neural network for speech recognition according to the optimization method for the network structure to obtain an optimized network structure, perform a performance evaluation on the optimized network structure, and update the parameters of the network structure optimizer according to the evaluation results to obtain a trained network structure optimizer, so that the network structure of the neural network for speech recognition can be subsequently optimized according to the trained network structure optimizer. The optimized network structure of the neural network for speech recognition can reduce redundant computing units or computing operations and reduce computing costs, and can also improve the performance of a model based on the network structure, and can accurately and quickly recognize speech and generate corresponding text.
[0117] In one implementation scenario, in order to improve the performance of text search, the server or terminal can determine multiple optimization methods for the network structure of the neural network for text search based on an input network structure of the neural network for text search, update the network structure of the neural network for text search according to the optimization method for the network structure to obtain an optimized network structure, perform a performance evaluation on the optimized network structure, and update the parameters of the network structure optimizer according to the evaluation results to obtain a trained network structure optimizer, so that the network structure of the neural network for text search can be subsequently optimized according to the trained network structure optimizer. The optimized network structure of the neural network for text search can reduce redundant computing units or computing operations and reduce computing costs, and can also improve the performance of a model based on the network structure, and can accurately and quickly obtain the corresponding search text according to the search information.
[0118] In one implementation scenario, in order to improve the performance of the question-answering system, the server or terminal can determine multiple optimization methods for the network structure of the neural network for question-answering based on the input network structure of the neural network for question-answering, update the network structure of the neural network for question-answering according to the optimization method for the network structure to obtain an optimized network structure, perform a performance evaluation on the optimized network structure, and update the parameters of the network structure optimizer according to the evaluation results to obtain a trained network structure optimizer, so that the network structure of the neural network for question-answering can be subsequently optimized according to the trained network structure optimizer. The optimized network structure of the neural network for question-answering can reduce redundant computing units or computing operations and reduce computing costs, and can also improve the performance of the model based on the network structure, and can accurately and quickly obtain the corresponding answer based on the question information.
[0119] The structure of the training device of the network structure optimizer of the neural network provided by the embodiment of the present invention is further described. The training device of the network structure optimizer of the neural network can be various terminals, such as a mobile phone, a computer, etc., and can also be a Figure 1 A server 100 is shown.
[0120] See also Figure 2 , Figure 2 is a structural diagram of a training device 500 of a network structure optimizer of a neural network provided in an embodiment of the present invention, Figure 2 The training device 500 of the network structure optimizer of the neural network shown includes: at least one processor 510, a memory 550, at least one network interface 520 and a user interface 530. The various components in the training device 500 of the network structure optimizer of the neural network are coupled together through a bus system 540. It can be understood that the bus system 540 is used to realize the connection and communication between these components. In addition to the data bus, the bus system 540 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, in Figure 2 Various buses are labeled as bus system 540 .
[0121] The processor 510 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.
[0122] The user interface 530 includes one or more output devices 531 that enable presentation of media content, including one or more speakers and / or one or more visual display screens. The user interface 530 also includes one or more input devices 532, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.
[0123] The memory 550 includes a volatile memory or a non-volatile memory, and may also include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 550 described in the embodiment of the present invention is intended to include any suitable type of memory. The memory 550 optionally includes one or more storage devices that are physically far away from the processor 510.
[0124] In some embodiments, the memory 550 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplarily described below.
[0125] Operating system 551, including system programs for processing various basic system services and performing hardware-related tasks, such as framework layer, core library layer, driver layer, etc., for implementing various basic services and processing hardware-based tasks;
[0126] A network communication module 552, for reaching other computing devices via one or more (wired or wireless) network interfaces 520, exemplary network interfaces 520 include: Bluetooth, Wireless Compatibility Certification (WiFi), and Universal Serial Bus (USB);
[0127] a display module 553 for enabling presentation of information via one or more output devices 531 (e.g., display screen, speaker, etc.) associated with the user interface 530 (e.g., a user interface for operating peripherals and displaying content and information);
[0128] The input processing module 554 is used to detect one or more user inputs or interactions from one of the one or more input devices 532 and translate the detected inputs or interactions.
[0129] In some embodiments, the training device of the network structure optimizer of the neural network provided by the embodiment of the present invention can be implemented in a combination of software and hardware. As an example, the training device of the network structure optimizer of the neural network provided by the embodiment of the present invention can be a processor in the form of a hardware decoding processor, which is programmed to execute the training method of the network structure optimizer of the neural network provided by the embodiment of the present invention. For example, the processor in the form of a hardware decoding processor can adopt one or more application specific integrated circuits (ASIC, Application Specific Integrated Circuit), DSP, programmable logic device (PLD, Programmable Logic Device), complex programmable logic device (CPLD, Complex Programmable Logic Device), field programmable gate array (FPGA, Field-Programmable Gate Array) or other electronic components.
[0130] In other embodiments, the training device of the network structure optimizer of the neural network provided by the embodiment of the present invention can be implemented in software. Figure 2 A training device 555 of a network structure optimizer of a neural network stored in a memory 550 is shown, which may be software in the form of a program and a plug-in, and includes a series of modules, including a first extraction module 5551, a first prediction module 5552, a first optimization module 5553 and a training module 5554; wherein the first extraction module 5551, the first prediction module 5552, the first optimization module 5553 and the training module 5554 are used to implement the training method of the network structure optimizer of a neural network provided in an embodiment of the present invention.
[0131] It can be understood from the above that the training method of the network structure optimizer of a neural network provided in the embodiment of the present invention can be implemented by training devices of various types of network structure optimizers of neural networks, such as smart terminals and servers.
[0132] The following describes the training method of the network structure optimizer of the neural network provided by the embodiment of the present invention in combination with the exemplary application and implementation of the server provided by the embodiment of the present invention. Figure 3A , Figure 3A is a flow chart of a training method for a network structure optimizer of a neural network provided by an embodiment of the present invention, combined with Figure 3A The steps shown are explained.
[0133] In step 101, a network structure optimizer is used to extract features from the network structure of a neural network to obtain feature information of the corresponding network structure.
[0134] In order to optimize the network structure of any input neural network, it is necessary to extract the features of the network structure of the neural network through a network structure optimizer to obtain the feature information of the corresponding network structure, so as to select the corresponding optimization method according to the feature information.
[0135] See also Figure 3B , Figure 3B is an optional flow chart provided by an embodiment of the present invention. In some embodiments, Figure 3B It is shown that step 101 can be performed by Figure 3B Steps 1011 to 1012 are implemented as shown.
[0136] In step 1011, a directed graph of the network structure of the neural network is established through a network structure optimizer.
[0137] In order to extract all the important features of the network structure, a corresponding directed graph can be established according to the network structure of the neural network, so as to perform feature extraction on the directed graph and obtain the feature information of the corresponding network structure to ensure that all the important features of the network structure are extracted.
[0138] In some embodiments, a directed graph for the network structure of a neural network is established through a network structure optimizer, including: sampling and processing the network structure of the neural network through the network structure optimizer to obtain network layer information for the network structure; and establishing a directed graph for the network structure based on the network layer information.
[0139] In order to extract the network layer information of the network structure, it is necessary to randomly sample the network structure of the neural network through a network structure optimizer, so as to extract the network layer information of the network structure, and establish a directed graph for the network structure according to the network layer information of the network structure.
[0140] In some embodiments, a directed graph for a network structure is established based on network layer information, including: determining input features or output features in the network layer information as node information in the directed graph; determining operation information in the network layer information as edge information in the directed graph; establishing a directed graph for the network structure based on the node information and the edge information; wherein the operation information includes at least one of the following: convolution operation, jump connection operation, pooling operation, empty connection operation.
[0141] The network layer information includes input features or output features, and operation information, wherein the operation information includes at least one of the following: convolution operation, jump connection operation, pooling operation, and empty connection operation, the input feature is the input node of the network layer, and the output feature is the output node of the network layer. The input features or output features in the network layer information are determined as the node information in the directed graph, and the operation information in the network layer information is determined as the edge information in the directed graph, so as to establish a directed graph for the network structure according to the node information and the edge information, so as to extract the feature information for the network structure according to the directed graph later.
[0142] In step 1012, feature extraction is performed on the directed graph to obtain feature information of the corresponding network structure.
[0143] After the directed graph is established, feature extraction is performed on the directed graph to obtain feature information of the corresponding network structure to ensure that all important features of the network structure are extracted.
[0144] In some embodiments, feature extraction is performed on a directed graph to obtain feature information of a corresponding network structure, including: determining node information and edge information in the directed graph; and determining feature information of the corresponding network structure based on parameter learnable matrices, activation functions, node information, and edge information in the graph convolutional network.
[0145] After establishing a directed graph for the network structure, we can first determine the node information and edge information in the directed graph. Subsequently, we can perform a series of processes such as convolution and full connection on the node information and edge information of the directed graph according to the graph convolutional network to determine the characteristic information of the corresponding network structure.
[0146] In some embodiments, characteristic information of a corresponding network structure is determined based on a parameter learnable matrix, activation function, node information, and edge information in a graph convolutional network, including: multiplying the edge information, node information, and the parameter learnable matrix in a first-layer graph convolutional network to obtain the output of the first-layer graph convolutional network; performing a nonlinear transformation on the output of the first-layer graph convolutional network through the activation function in the graph convolutional network to obtain the transformed output of the first-layer graph convolutional network; multiplying the transformed output of the first-layer graph convolutional network and the parameter learnable matrix in a second-layer graph convolutional network to obtain the output of the second-layer graph convolutional network; multiplying the output of the second-layer graph convolutional network, the edge information, and the parameter learnable matrix of the fully connected layer in the graph convolutional network to obtain the characteristic information of the corresponding network structure.
[0147] The graph convolution network can use two layers of convolution layers, but the present invention is not limited to two layers of convolution layers. In order to extract the characteristic information of the network structure, the directed graph can be input into the graph convolution network, and the characteristic information of the corresponding network structure can be obtained by calculating the two layers of graph convolution network and the fully connected layer in turn.
[0148] In step 102, the characteristic information is predicted by a network structure optimizer to determine a plurality of optimization methods for the network structure.
[0149] After extracting the characteristic information of the network structure, the characteristic information can be predicted by the network structure optimizer, so as to determine multiple optimization methods for the network structure, so as to subsequently optimize the network structure through the optimization methods.
[0150] In some embodiments, the characteristic information is predicted by a network structure optimizer to determine multiple optimization methods for the network structure, including: classifying the characteristic information by the network structure optimizer to determine the probability of the optimization method corresponding to the network structure; and determining the optimization method for the network structure that meets the probability requirements among multiple optimization methods based on the probability of the optimization method of the network structure.
[0151] After the feature information is classified by the network structure optimizer and the probability of the optimization method of the corresponding network structure is determined, it can be determined whether the probability of the optimization method of the network structure is greater than the set threshold. If the probability of the optimization method of the network structure is greater than the set threshold, it is determined that the optimization method corresponding to the probability is the optimization method for the network structure; if the probability of the optimization method of the network structure is less than or equal to the set threshold, it is determined that the optimization method corresponding to the probability is not the optimization method for the network structure, wherein the set threshold is a parameter value pre-set by the user in the server. After the feature information is classified by the network structure optimizer and the probability of the optimization method of the corresponding network structure is determined, the probabilities of the optimization methods of the corresponding network structure can be sorted in descending order, and the optimization methods corresponding to the first K probabilities are determined to be the optimization methods for the network structure, wherein K is a parameter value pre-set by the user in the server.
[0152] In step 103, the network structure of the neural network is updated according to an optimization method for the network structure to obtain an optimized network structure.
[0153] After determining the optimization method of the network structure, the network structure optimizer can update and replace the original structure in the network structure of the neural network according to the optimization method of the network structure to obtain an optimized network structure, so as to subsequently perform performance evaluation based on the optimized network structure and the network structure before optimization.
[0154] In some embodiments, the network structure of the neural network is updated according to an optimization method for the network structure to obtain an optimized network structure, including: determining the operation information, the size of the network layer, and the number of network layers in the optimization method; replacing the operation information, the size of the network layer, and the number of network layers in the network structure of the neural network with the operation information, the size of the network layer, and the number of network layers in the optimization method to obtain the optimized network structure; wherein the size of the network layer includes at least one of the following: the size of the convolution kernel, the size of the pooling layer.
[0155] The operation information includes at least one of the following: convolution operation, jump connection operation, pooling operation, and empty connection operation. In order to achieve a network structure with lower computational complexity after network structure optimization, each operation in the network structure can be replaced (optimization method), for example, the convolution operation can be changed into a jump connection operation or an empty connection operation, and the jump connection operation can be changed into an empty connection operation, etc. The size of the network layer in the network structure can also be replaced, for example, the convolution kernel 5*5 can be replaced with the convolution kernel 3*3. The number of network layers in the network structure can also be replaced, for example, 3 convolution layers 3*3 can be replaced with 2 convolution layers 3*3.
[0156] In step 104, the performance of the optimized network structure is evaluated, and the parameters of the network structure optimizer are updated according to the evaluation results.
[0157] In order to train the network structure optimizer, performance evaluation can be performed based on the network structure before optimization and the network structure after optimization, and the parameters of the network structure optimizer can be updated based on the evaluation results to train the network structure optimizer.
[0158] In some embodiments, a performance evaluation is performed on the optimized network structure, and the parameters of the network structure optimizer are updated according to the evaluation results, including: visualizing the optimized network structure and the network structure of the neural network, respectively, to obtain visualization results of the corresponding optimized network structure and the network structure of the neural network; and updating the parameters of the network structure optimizer in response to adjustment operations corresponding to the visualization results.
[0159] The performance of the optimized network structure can be evaluated through visualization. The optimized network structure and the network structure before optimization are visualized respectively to obtain the visualization results of the corresponding optimized network structure and the network structure before optimization, and the visualization results are presented to the user. The user can adjust the optimized network structure and the network structure before optimization according to the visualization structure. After receiving the user's adjustment of the optimized network structure and the network structure before optimization, the server updates the parameters of the network structure optimizer in response to the adjustment operation of the corresponding visualization result to train the network structure optimizer.
[0160] In some embodiments, a performance evaluation is performed on the optimized network structure, and the parameters of the network structure optimizer are updated based on the evaluation results, including: determining the accuracy of the optimized network structure relative to the network structure of the neural network based on the optimized network structure and the network structure of the neural network; constructing a loss function of the network structure optimizer based on the accuracy; and updating the parameters of the network structure optimizer until the loss function converges.
[0161] After the server determines the value of the loss function of the network structure optimizer based on the accuracy of the optimized network structure relative to the network structure of the neural network, it can determine whether the value of the loss function exceeds the preset threshold. When the value of the loss function exceeds the preset threshold, the error signal of the network structure optimizer is determined based on the loss function, the error information is back-propagated in the network structure optimizer, and the model parameters of each layer are updated during the propagation process.
[0162] Here, back propagation is explained. The training sample data is input into the input layer of the neural network model, passes through the hidden layer, and finally reaches the output layer and outputs the result. This is the forward propagation process of the neural network model. Since there is an error between the output result of the neural network model and the actual result, the error between the output result and the actual value is calculated, and the error is backpropagated from the output layer to the hidden layer until it propagates to the input layer. During the back propagation process, the value of the model parameter is adjusted according to the error; the above process is continuously iterated until convergence. Among them, the network structure optimizer belongs to the neural network model.
[0163] So far, the training method of the network structure optimizer of the neural network provided by the embodiment of the present invention has been described in combination with the exemplary application and implementation of the server provided by the embodiment of the present invention. The following will continue to describe the scheme for cooperating among the modules in the training device 555 of the network structure optimizer of the neural network provided by the embodiment of the present invention to implement the training of the network structure optimizer of the neural network.
[0164] The first extraction module 5551 is used to extract features of the network structure of the neural network through the network structure optimizer to obtain feature information corresponding to the network structure;
[0165] A first prediction module 5552, configured to predict the feature information through the network structure optimizer and determine a plurality of optimization methods for the network structure;
[0166] A first optimization module 5553, used to update the network structure of the neural network according to the optimization method for the network structure to obtain an optimized network structure;
[0167] The training module 5554 is used to perform performance evaluation on the optimized network structure and update the parameters of the network structure optimizer according to the evaluation results.
[0168] In some embodiments, the first extraction module 5551 is also used to establish a directed graph of the network structure of the neural network through the network structure optimizer; perform feature extraction on the directed graph to obtain feature information corresponding to the network structure.
[0169] In some embodiments, the first extraction module 5551 is also used to sample the network structure of the neural network through the network structure optimizer to obtain network layer information for the network structure; and establish a directed graph for the network structure based on the network layer information.
[0170] In some embodiments, the first extraction module 5551 is also used to determine the input features or output features in the network layer information as node information in a directed graph; determine the operation information in the network layer information as edge information in the directed graph; establish a directed graph for the network structure based on the node information and the edge information; wherein the operation information includes at least one of the following: convolution operation, jump connection operation, pooling operation, empty connection operation.
[0171] In some embodiments, the first extraction module 5551 is also used to determine the node information and edge information in the directed graph; based on the parameter learnable matrix, activation function, the node information and the edge information in the graph convolutional network, determine the feature information corresponding to the network structure.
[0172] In some embodiments, the first extraction module 5551 is also used to multiply the edge information, the node information, and the parameter learnable matrix in the first layer of the graph convolution network to obtain the output of the first layer of the graph convolution network; perform a nonlinear transformation on the output of the first layer of the graph convolution network through the activation function in the graph convolution network to obtain the transformed output of the first layer of the graph convolution network; multiply the output of the transformed first layer of the graph convolution network and the parameter learnable matrix in the second layer of the graph convolution network to obtain the output of the second layer of the graph convolution network; multiply the output of the second layer of the graph convolution network, the edge information, and the parameter learnable matrix of the fully connected layer in the graph convolution network to obtain feature information corresponding to the network structure.
[0173] In some embodiments, the first prediction module 5552 is also used to classify the feature information through the network structure optimizer to determine the probability of the optimization method corresponding to the network structure; based on the probability of the optimization method of the network structure, determine the optimization method for the network structure that meets the probability requirements among the multiple optimization methods.
[0174] In some embodiments, the first optimization module 5553 is also used to determine the operation information, the size of the network layer and the number of network layers in the optimization method; replace the operation information, the size of the network layer and the number of network layers in the network structure of the neural network with the operation information, the size of the network layer and the number of network layers in the optimization method to obtain an optimized network structure; wherein the size of the network layer includes at least one of the following: the size of the convolution kernel, the size of the pooling layer.
[0175] In some embodiments, the training module 5554 is also used to visualize the optimized network structure and the network structure of the neural network, respectively, to obtain visualization results corresponding to the optimized network structure and the network structure of the neural network; and update the parameters of the network structure optimizer in response to adjustment operations corresponding to the visualization results.
[0176] In some embodiments, the training module 5554 is also used to determine the accuracy of the optimized network structure relative to the network structure of the neural network based on the optimized network structure and the network structure of the neural network; based on the accuracy, construct a loss function of the network structure optimizer; and update the parameters of the network structure optimizer until the loss function converges.
[0177] Based on the above description of the training method and structure of the network structure optimizer of the neural network, the following describes the optimization method of the network structure of the neural network and the optimization device of the network structure of the neural network provided by the embodiment of the present invention. Figure 4 , Figure 4 is a schematic diagram of the structure of a device 600 for optimizing the network structure of a neural network provided by an embodiment of the present invention, Figure 4The network structure optimization device 600 of the neural network shown includes: at least one processor 610, a memory 650, at least one network interface 620 and a user interface 630. The functions of the processor 610, the memory 650, the at least one network interface 620 and the user interface 630 are similar to those of the processor 510, the memory 550, the at least one network interface 520 and the user interface 530, that is, the functions of the output device 631 and the input device 632 are similar to those of the output device 531 and the input device 532, and the functions of the operating system 651, the network communication module 652, the display module 653 and the input processing module 654 are similar to those of the operating system 551, the network communication module 552, the display module 553 and the input processing module 554, and are not described in detail.
[0178] In other embodiments, the device for optimizing the network structure of a neural network provided by the embodiments of the present invention may be implemented in software. Figure 4 An optimization device 655 for the network structure of a neural network stored in a memory 650 is shown, which may be software in the form of a program and a plug-in, and includes a series of modules, including a second extraction module 6551, a second prediction module 6552, and a second optimization module 6553; wherein the second extraction module 6551, the second prediction module 6552, and the second optimization module 6553 are used to implement the optimization method for the network structure of a neural network provided in an embodiment of the present invention.
[0179] It can be understood from the above that the method for optimizing the network structure of a neural network provided in the embodiment of the present invention can be implemented by various types of neural network structure optimization devices, such as smart terminals and servers.
[0180] The following describes the optimization method of the network structure of the neural network provided by the embodiment of the present invention in combination with the exemplary application and implementation of the server provided by the embodiment of the present invention. Figure 5 , Figure 5 is a flow chart of a method for optimizing the network structure of a neural network provided by an embodiment of the present invention, combined with Figure 5 The steps shown are explained.
[0181] In step 201, a network structure optimizer is used to extract features from the network structure of a neural network to obtain feature information of the corresponding network structure.
[0182] In some embodiments, a network structure optimizer is used to perform feature extraction on the network structure of a neural network to obtain feature information of the corresponding network structure, including: establishing a directed graph for the network structure of the neural network through the network structure optimizer; and performing feature extraction on the directed graph to obtain feature information of the corresponding network structure.
[0183] In some embodiments, a directed graph for the network structure of a neural network is established through a network structure optimizer, including: sampling and processing the network structure of the neural network through the network structure optimizer to obtain network layer information for the network structure; and establishing a directed graph for the network structure based on the network layer information.
[0184] In some embodiments, a directed graph for a network structure is established based on network layer information, including: determining input features or output features in the network layer information as node information in the directed graph; determining operation information in the network layer information as edge information in the directed graph; establishing a directed graph for the network structure based on the node information and the edge information; wherein the operation information includes at least one of the following: convolution operation, jump connection operation, pooling operation, empty connection operation.
[0185] In some embodiments, feature extraction is performed on a directed graph to obtain feature information of a corresponding network structure, including: determining node information and edge information in the directed graph; and determining feature information of the corresponding network structure based on parameter learnable matrices, activation functions, node information, and edge information in the graph convolutional network.
[0186] In some embodiments, characteristic information of a corresponding network structure is determined based on a parameter learnable matrix, activation function, node information, and edge information in a graph convolutional network, including: multiplying the edge information, node information, and the parameter learnable matrix in a first-layer graph convolutional network to obtain the output of the first-layer graph convolutional network; performing a nonlinear transformation on the output of the first-layer graph convolutional network through the activation function in the graph convolutional network to obtain the transformed output of the first-layer graph convolutional network; multiplying the transformed output of the first-layer graph convolutional network and the parameter learnable matrix in a second-layer graph convolutional network to obtain the output of the second-layer graph convolutional network; multiplying the output of the second-layer graph convolutional network, the edge information, and the parameter learnable matrix of the fully connected layer in the graph convolutional network to obtain the characteristic information of the corresponding network structure.
[0187] In step 202, the characteristic information is predicted by a network structure optimizer to determine an optimization method for the network structure.
[0188] In some embodiments, the characteristic information is predicted by a network structure optimizer to determine an optimization method for the network structure, including: classifying the characteristic information by the network structure optimizer to determine the probability of the optimization method corresponding to the network structure; and determining an optimization method for the network structure that meets the probability requirements among multiple optimization methods based on the probability of the optimization method of the network structure.
[0189] In step 203, the network structure of the neural network is updated according to an optimization method for the network structure to obtain an optimized network structure.
[0190] In some embodiments, the network structure of the neural network is updated according to an optimization method for the network structure to obtain an optimized network structure, including: determining the operation information, the size of the network layer, and the number of network layers in the optimization method; replacing the operation information, the size of the network layer, and the number of network layers in the network structure of the neural network with the operation information, the size of the network layer, and the number of network layers in the optimization method to obtain the optimized network structure; wherein the size of the network layer includes at least one of the following: the size of the convolution kernel, the size of the pooling layer.
[0191] So far, the method for optimizing the network structure of a neural network provided by an embodiment of the present invention has been described. Now, the following will continue to describe a solution for optimizing the network structure of a neural network by cooperating among various modules in the device 655 for optimizing the network structure of a neural network provided by an embodiment of the present invention.
[0192] A second extraction module 6551 is used to extract features of the network structure of the neural network through the network structure optimizer to obtain feature information corresponding to the network structure;
[0193] A second prediction module 6552 is used to predict the characteristic information through the network structure optimizer to determine an optimization method for the network structure;
[0194] The second optimization module 6553 is used to update the network structure of the neural network according to the optimization method for the network structure to obtain an optimized network structure.
[0195] It should be pointed out here that the description of the above device is similar to the description of the above method, and the description of the beneficial effects of the same method will not be repeated. For technical details not disclosed in the device described in the embodiment of the present invention, please refer to the description of the embodiment of the method of the present invention.
[0196] The following describes an exemplary application of an embodiment of the present invention in a practical application scenario.
[0197] Deep learning based on deep neural networks has attracted widespread attention from academia and industry, and has achieved breakthrough results in many application fields, including image recognition, object detection, semantic segmentation, speech recognition, and natural language processing. At present, the network structure of neural networks mainly comes from two design methods. One is that people use existing experience to manually design the neural network structure, and the other is to use neural network structure search technology to automatically let the computer search for the network structure. However, the neural networks designed by the two methods still have some redundant computing units or computing operations. These redundancies not only increase the computing cost, but also reduce the performance of the model designed based on the network structure. These problems limit the performance of deep neural network models in practical application scenarios and their application on resource-constrained computing platforms. Therefore, it is necessary to optimize the network structure without introducing additional computing costs to improve performance. In order to solve the above problems, the optimization problem is converted into a Markov decision process, and more efficient operations (such as skipping connections or directly removing connections) are used to replace redundant operations. Network address translation is trained through reinforcement learning to obtain optimization strategies for different structures.
[0198] Neural network structure search methods include manual artificial design and automatic network structure search methods. Among them, the manual artificial design method is the current mainstream neural network design method. Different from the manual method, the neural network structure search uses a controller to automatically generate the structure of the neural network. By using reinforcement learning technology or other related technologies to optimize the controller, the controller can generate the optimal neural network structure.
[0199] Automatic compression of network structure: compress the existing neural network according to the specific hardware platform, and obtain a more streamlined network structure by changing parameters such as the convolution kernel size and the number of convolution kernels of the convolution layer.
[0200] Artificially designed neural network: The network structure of the neural network is manually designed based on experience. The classic network structure constructs a neural network model by stacking convolutional layers, such as Figure 6 As shown, Figure 6 is a diagram of a deep neural network structure of stacked convolutional layers provided in an embodiment of the present invention. In addition, the neural network can also construct a model by introducing additional connections, such as ResNet. Figure 7 As shown, Figure 7 This is a structural diagram of a deep neural network with additional connections provided by an embodiment of the present invention.
[0201] However, manually designed network structures often contain a large number of redundant computing modules, which introduces additional computational overhead and limits the performance of deep neural network models.
[0202] Neural Architecture Search (NAS): Figure 8 As shown, Figure 8 : is a system block diagram of the NAS provided by an embodiment of the present invention. Specifically, NAS generates the structure of the neural network by using a controller based on LS TM, for example, for a convolutional neural network, it includes the number of channels of the convolution, the height and width of the convolution kernel, etc.; for a recurrent neural network, it includes the connected nodes and the activation function, etc. In this way, a possible specific structure of the neural network and the probability of the controller generating the structure can be obtained. The parameters of the model are trained on a specific task using the structure to obtain the performance of the structure. Finally, the performance of the model (generally the accuracy) and the probability of generating the structure are fed back to the controller, and the performance of the controller is optimized by reinforcement learning technology so that it can generate a better network structure. After continuously repeating the above process, the network structure generated by the controller will perform better and better on specific tasks, thereby achieving the purpose of automatically generating a neural network structure using a computer.
[0203] However, the training cost of NAS is very high. Every time a network structure is generated, a neural network based on the network structure needs to be retrained to obtain performance indicators of the network structure as a signal for controller optimization. Since training a neural network from scratch each time consumes huge resources, the training process of NAS consumes a lot of resources.
[0204] To solve this problem, Efficient Neural Architecture Search (ENAS) improves the efficiency of network architecture search by using weight sharing technology based on the NAS model. Specifically, ENAS assumes that the network structure generated by the controller each time is a subgraph of a large directed acyclic graph. Each edge in the subgraph has a corresponding weight, and these weights are shared by all subgraphs. For example, Fig. 9 As shown, Fig. 9 is a schematic diagram of a DAG structure in a neural network provided by an embodiment of the present invention, Fig. 9 It is a directed acyclic graph with 7 nodes. Each node represents a computing node, which can process the transmitted information; and the connection between nodes represents the method of information transmission. The connection between nodes and the operation of nodes on input are obtained through controller sampling. Fig. 9The "-2" and "-1" nodes represent two input nodes, the nodes {0, 1, 2, 3} represent intermediate nodes, and "output" represents output nodes. The lines between nodes represent the connection relationship, and each line has a specific operation (such as convolution operation, pooling operation, etc.). The weights required for these operations are shared by any sub-network. In other words, as long as a network uses the connection between i and j, then for any operation on the information passed to node j (such as a convolution operation with a convolution kernel of 3*3), the weights used are the same. These weights are part of the model parameters and are optimized during the training process.
[0205] Automatic compression of network structure: The automatic compression method mainly adjusts parameters such as the size and number of convolution kernels in the convolution layer to achieve the purpose of model compression. For example, the number of convolution kernels can be automatically learned and redundant convolution kernels can be removed to achieve the purpose of model compression.
[0206] In order to optimize the network structure, a network structure can be encoded into an embedding vector in a continuous space through the NAO method, and then gradient descent is performed to obtain a better embedding vector, and a decoder is used to map the embedding vector back to the network structure (i.e., the optimized network structure). Fig.10 As shown, Fig.10 is a comparative schematic diagram of network structure optimization provided by an embodiment of the present invention, wherein the NAO method often generates a network structure that is completely different from the input and introduces additional parameters or additional computational costs. The NAO method has the same search space as other network structure automatic search methods, and its search space is relatively large, making it difficult to train the model.
[0207] The network structures obtained by the existing network structure design methods contain many redundant computing operations, which will cause the model to introduce high computing costs and affect the performance of the model. Therefore, the operations in the network structure can be optimized to reduce redundancy and improve performance. For the automatic compression method of the network structure, only the size and number of convolution kernels can be modified, but the type of operation cannot be modified, which greatly limits the optimization of the network structure.
[0208] The network structure optimizer provided in the embodiment of the present invention can automatically optimize different network structures based on a given arbitrary network structure as input, so as to reduce the redundancy of the model and improve the performance of the model. Fig.11 As shown, Fig.11 It is a schematic diagram of the system structure provided by an embodiment of the present invention. By training a network structure optimizer, optimization of any network structure is achieved, so that the optimized network structure has better performance than the original network structure, while ensuring that no additional computing overhead is added.
[0209] The training process of the network structure optimizer in the embodiment of the present invention is as follows:
[0210] 1) For the input network structure, first extract the characteristic information of the network structure, which is then used for the optimization method of the network structure optimizer. Specifically, the network structure optimizer calculates the probability of different optional operations that can replace each computing operation in the network structure, and then samples according to the probability value to obtain the optimal network structure optimization method;
[0211] 2) The network structure optimizer generates several possible candidate network structures according to the optimization method. These network structures are all the better network structures determined by the network structure optimizer;
[0212] 3) For each candidate network structure, its performance is evaluated and the network structure optimizer is guided for training.
[0213] The network structure optimization process of the network structure optimizer in the embodiment of the present invention is as follows:
[0214] 1) For the input network structure, first extract the characteristic information of the network structure, which is used for the optimization method of the network structure optimizer;
[0215] 2) The network structure optimizer generates several possible candidate network structures according to the optimization method. These network structures are all the better network structures determined by the network structure optimizer;
[0216] 3) Evaluate the performance of each candidate network on the validation set, select the optimal network structure as the network structure suitable for the data set, and complete the network structure optimization.
[0217] Methods for feature extraction of network structures:
[0218] like Fig.12 As shown, Fig.12 is a schematic diagram of a network structure provided by an embodiment of the present invention, such as Fig.13 As shown, Fig.13 is a directed graph representation schematic diagram corresponding to the network structure provided by an embodiment of the present invention, Fig.12 The network structure in is converted into Fig.13 The directed graph in is represented by Fig.13 As can be seen, the input features or output features of the network layer are represented by nodes in the directed graph (numbered squares), and the operations of the network layer (such as convolution kernel 3x3 (conv_3x3) and skip connection (skipconnection)) are represented by the lines between the nodes in the graph structure. Therefore, the directed graph representation can completely retain the information in the network structure.
[0219] In order to achieve a network structure with lower computational complexity after network structure optimization, each operation in the network structure can be performed as follows Fig.14 Replace it in the way shown (optimized way), Fig.14 It is a schematic diagram of operation conversion rules in a network structure provided by an embodiment of the present invention. Fig.14 O represents other computing operations in the network structure except skip connection and empty connection operations, including convolution operations, pooling operations, etc.; S represents skip connection, that is, skip connection operation; N represents empty connection, that is, no computing operation. Fig.14 The relationship between the computational costs is c(O)>c(S)>c(N), where c(.) represents a function that measures the computational cost. The computational operation O can be transformed into a jump connection S or an empty connection N, and the jump connection S can be transformed into an empty connection N. Although the computational cost of operation S is slightly higher than that of operation N, the jump connection S often brings about a significant performance improvement. Therefore, the embodiment of the present invention also allows operation N to be transformed into S.
[0220] The training method of the network structure optimizer is as follows:
[0221] 1) A graph convolutional neural network is used to extract features from a network structure represented by a directed graph, and the probability of an optional operation that can replace each operation is calculated. The embodiment of the present invention uses a two-layer graph convolutional network, and its calculation formula is shown in formula (1):
[0222] Z=f(X,A)=Softmax(Aσ(AXW (0) )W (1) W FC ) (1)
[0223] Among them, X represents the input features of the graph structure data (node information), A represents the adjacency matrix (edge information) of the graph structure, the Softmax function is used to generate the probabilities of different possible optimization methods, the σ function represents a certain activation function (such as ReLU), and W (0) and W (1) denote the parameters of the first and second graph convolutional layers, respectively, and W FC Represents the parameters of the last fully connected layer of the graph convolutional network. Among them, {W (0) , W (1) , W FC} are trainable parameters.
[0224] Regarding the network structure feature extraction method, in addition to using a graph convolutional network, a long short-term memory recurrent neural network can also be used for feature extraction. That is, the graph data representing the optimized network structure can be represented as a string sequence, and then the long short-term memory recurrent neural network is used to predict each character in the string one by one, and the types of different operations in the network structure can also be replaced and optimized. The present invention is not limited to graph convolutional networks and long short-term memory recurrent neural networks, and other neural networks can also extract network structure features.
[0225] 2) Enter a specific network structure In order to obtain a better network structure α, the following objective function can be optimized, as shown in formula (2):
[0226]
[0227] in, Represents a given input network The performance difference of the optimized structure α is obtained (performance is generally measured by accuracy), c(.) represents the function that measures the computational cost, and k represents a constant that limits the upper limit of the computational cost. Maximizing the performance difference while ensuring that the computational cost is within an acceptable range can achieve the purpose of optimizing the network structure.
[0228] When a variety of different network structures are input as training data, in order to ensure that the optimizer proposed in the embodiment of the present invention can optimize any network structure, the specific optimization target is shown in formula (3):
[0229]
[0230] Among them, β represents the network structure variable, representing a certain input network structure, p(.) represents a certain distribution of the network structure, π(.|β;θ) represents the optimization strategy given β and parameter θ, α represents the optimized network structure variable, and R(α|β) represents the performance difference of the optimized structure α obtained by the given input network β (performance is generally measured by accuracy).
[0231] It can be seen from the formula that the objective function of the embodiment of the present invention is affected by the model performance improvement value, that is, the evaluation performance of the optimized network structure can guide the training of the network structure optimizer.
[0232] In actual training, the above objective function can be implemented by sampling, and the objective function can be rewritten as shown in formula (4):
[0233]
[0234] Where π(α|β; θ) represents the probability of sampling α given the input network structure β and optimizer parameters θ, (R(α,w) represents the model performance of the network structure α under the model parameters w, H(π(.|β;θ)) represents the entropy of the optimization method π(.|β;θ), and λ is a constant for adjusting the weight.
[0235] The network structure optimizer is updated using the gradient descent method. The gradient of the network structure optimizer parameters can be calculated using the following formula (5):
[0236]
[0237] 3) Iterate the optimization step 2) until the network structure optimizer converges.
[0238] After the above steps, the network structure optimizer can process enough network structures, and improve the optimization ability of the network structure optimizer for any network structure by optimizing the objective function in step 2). After the network structure optimizer is trained, the network structure optimization step can be performed to complete the network structure optimization.
[0239] In the automated machine learning (AutoML) product of the embodiment of the present invention, the network structure can be automatically optimized according to the network structure input by the user, so as to obtain a network structure with lower computing cost and better performance, meet the needs of different application scenarios, and achieve a better "automated" user experience function.
[0240] Fig.15 It is a flow chart of the AutoML product provided by an embodiment of the present invention. In a specific application scenario, the user only needs to prepare the neural network structure required by the relevant business, and input it into the network structure optimizer proposed in the present invention, which will automatically generate an optimized network structure to achieve the purpose of network structure optimization, that is, to improve the performance of the network structure without introducing additional computing costs or reducing computing costs. The network structure optimizer in the embodiment of the present invention will optimize any network structure provided by the user. Specific process: 1) The user uploads an arbitrary neural network structure to the AutoML platform; 2) Extract feature information of the input network structure; 3) The AutoML platform will obtain a better network structure based on the extracted feature information; 4) Output the network structure for the user to use.
[0241] The embodiment of the present invention applies the network structure optimizer to the artificially designed neural network and NAS, and verifies it on two benchmark image classification datasets (CIFAR-10 dataset and ImageNet dataset).
[0242] Consider two network structures in a deep neural network, namely the network structure of the computing module and the network structure of the downsampling module. The network structure of the computing module retains the spatial size of the input network structure, while the network structure of the downsampling module reduces the spatial size of the input network structure by 2 times. Both the network structure of the computing module and the network structure of the downsampling module contain 2 input nodes and multiple intermediate nodes.
[0243] The network structure optimizer (NAT) is applied to three artificially designed neural networks (VGG, Res Net, MobileNet). In order to make all architectures share the same graph structure representation method, empty connections can be added to the artificially designed neural networks to ensure that each node has two input nodes. For fair comparison, the deep neural network is constructed using the network structure of the computation module and the network structure of the downsampling module while maintaining the same depth and number of channels as the original model. As shown in Table 1, NAT is always much better than the original model. In addition, Fig.16 The network structure of the computing module and the architecture of the downsampling module are shown in the figure. Fig.16 It is a directed graph representation and a schematic diagram of the network structure of the computing module and the network structure of the downsampling module provided in an embodiment of the present invention. The results show that NAT can improve the artificially designed neural network through optimization without introducing additional calculation connections. As can be seen from Table 1, although the NAO model has better performance than the original model, the NAO model has more parameters and higher computational costs. In contrast, NAT-VGG, NAT-ResNet and NAT-MobileNetV2 are significantly better than the original model. Among them, Acc. (%) represents the average accuracy of five random trials, #Params (M) represents the number of parameters, #MAdds (M) represents the number of addition and multiplication operations in the calculation, M represents the order of one million, and " / " represents the original model that has not been optimized.
[0244] Table 1
[0245]
[0246]
[0247] For NAS architectures, the Network Architecture Optimizer (NAT) is applied to three state-of-the-art NAS-based architectures, namely DARTS, NAONet, and ENAS
[33] . In addition, comparisons are made with other NAS-based architectures, namely AmoebaNet, PNAS, SNAS, and GHN, as shown in Table 2. As can be seen from Table 2, all NAT-based architectures achieve higher accuracy on CIFAR-10 relative to the baseline model and the NAO-optimized model. Compared with other NAS-based architectures, NAT-DART performs the best on CIFAR-10 and achieves competitive performance with lower computational cost and fewer parameters than the best architecture on ImageNet (i.e., AmoebaNet). The network structure of the computational module and the network structure of the downsampling module are visualized as shown in Figure 2. Fig.17 As shown, where skip_connect represents skip connection, null represents empty connection, conv represents convolution kernel, max_pool represents maximum pooling, avg_pool represents average pooling, sep_conv represents depthwise separable convolution, and dil_conv represents dilated convolution. For DARTS and NAONet, NAT replaces multiple redundant operations with skip connections or directly deletes connections, thereby reducing the number of parameters. While optimizing ENAS, NAT eliminates the average pooling operation and improves performance without introducing additional calculations. Wherein, Acc.(%) represents the average accuracy of five random trials, #Params(M) represents the number of parameters, #MAdds(M) represents the number of addition and multiplication operations in the calculation, M represents the order of one million, " / " represents the original model that has not been optimized, and "-" represents that the results are not reported.
[0248] Table 2
[0249]
[0250] More validation is performed on CIFAR-10 to compare different optimization methods (such as random search, LS TM and GCN) and different reasoning methods (i.e., sampling-based and maximum probability-based methods). For the NAS method, random conversions between 0, S and N are performed on the input architecture. As shown in Table 3, the performance comparison of the network structure obtained by different methods on CIFAR-10, where Maximum-GCN means that the network structure is derived by selecting the operation with the maximum probability, Sampling-GCN (the method adopted by the optimizer of the present invention) means sampling according to the probability distribution, and the Sampling-GCN method is superior to all other methods. Wherein, " / " represents the original model that has not been optimized.
[0251] Table 3
[0252]
[0253] The optimization problem is transformed into a Markov decision process (MDP), and a series of optimization methods are used to optimize the existing operations, including skip connections and empty operations. The CIFAR-10 and ImageNet datasets are used to prove that the method used in the embodiment of the present invention can improve the accuracy and compactness of the neural network structure. Fig.16 and Fig.17 It can be seen that the network structure optimizer proposed in the present invention can convert the two empty connections (null) in the input network structure into two skip connections (skip_connect). Through such replacement, the performance of the model can be greatly improved without increasing the amount of calculation. The specific performance indicators are shown in Table 4, which is a performance comparison before and after optimization of different input network structures (evaluated by classification accuracy):
[0254] Table 4
[0255]
[0256] Embodiments of the present invention are intended to optimize any architecture to obtain better performance without requiring additional computational costs. To achieve this goal, the network structure optimizer can delete redundant paths and can replace original operations with jump connections to improve the network structure. The structure optimization process is converted into a Markov decision process (MDP). In order to better utilize the structural information of the structure graph, a graph convolutional network can be used to convert any given network structure into a better directed graph structure. In summary, the present invention solves the problem of redundancy in existing neural network structure computing modules and also realizes the function of optimizing any network structure.
[0257] In summary, the embodiment of the present invention optimizes the network structure of the neural network through the network structure optimizer, which has the following beneficial effects:
[0258] The network structure optimizer predicts feature information, determines the optimization method for the network structure, and optimizes the network structure according to the optimization method. Any input network structure can be optimized; redundant computing units or computing operations in the network structure are removed, thereby saving subsequent computing power; the neural network model significantly improves model performance based on the optimized network structure and is suitable for various application scenarios.
[0259] The above description is only an embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement and improvement made within the spirit and scope of the present invention are included in the protection scope of the present invention.
Claims
1. A training method for a network structure optimizer of a neural network, characterized in that: The method comprises: Extracting features of the network structure of the neural network through the network structure optimizer to obtain feature information corresponding to the network structure, wherein the feature information is obtained by processing node information and edge information in a directed graph of the network structure, the node information is an input feature or an output feature in the network structure, and the edge information is operation information in the network structure; Predicting the characteristic information by the network structure optimizer to determine a plurality of optimization methods for the network structure; The network structure of the neural network is updated according to the optimization method for the network structure to obtain an optimized network structure; the optimized network structure is used for image recognition or speech recognition; A performance evaluation is performed on the optimized network structure, and parameters of the network structure optimizer are updated according to the evaluation results.
2. The method according to claim 1, characterized in that The extracting features of the network structure of the neural network by the network structure optimizer to obtain feature information corresponding to the network structure includes: By means of the network structure optimizer, a directed graph of the network structure of the neural network is established; Feature extraction is performed on the directed graph to obtain feature information corresponding to the network structure.
3. The method according to claim 2, characterized in that The step of establishing a directed graph of the network structure of the neural network by the network structure optimizer includes: The network structure of the neural network is sampled and processed by the network structure optimizer to obtain network layer information for the network structure; A directed graph for the network structure is established according to the network layer information.
4. The method according to claim 3, characterized in that The step of establishing a directed graph for the network structure according to the network layer information includes: Determine the input feature or the output feature in the network layer information as the node information in the directed graph; Determining the operation information in the network layer information as the edge information in the directed graph; Establishing a directed graph for the network structure according to the node information and the edge information; The operation information includes at least one of the following: a convolution operation, a jump connection operation, a pooling operation, and a null connection operation.
5. The method according to claim 2, characterized in that: The step of extracting features from the directed graph to obtain feature information corresponding to the network structure includes: Determine the node information and the edge information in the directed graph; According to the parameters in the graph convolutional network, the matrix, the activation function, the node information and the edge information can be learned to determine the feature information corresponding to the network structure.
6. The method according to claim 5, characterized in that The step of determining feature information corresponding to the network structure based on a learnable matrix, an activation function, the node information, and the edge information in the graph convolutional network includes: Multiplying the edge information, the node information, and a parameter learnable matrix in the first layer of the graph convolutional network to obtain an output of the first layer of the graph convolutional network; Performing a nonlinear transformation on the output of the first-layer graph convolutional network through an activation function in the graph convolutional network to obtain a transformed output of the first-layer graph convolutional network; The output of the first-layer graph convolutional network after the transformation and the parameter learnable matrix in the second-layer graph convolutional network are multiplied to obtain the output of the second-layer graph convolutional network; The output of the second-layer graph convolutional network, the side information, and the parameter learning matrix of the fully connected layer in the graph convolutional network are multiplied to obtain feature information corresponding to the network structure.
7. The method according to claim 1, characterized in that The predicting of the characteristic information by the network structure optimizer to determine a plurality of optimization methods for the network structure includes: Classifying the characteristic information by the network structure optimizer to determine the probability of the optimization method corresponding to the network structure; According to the probability of the optimization method of the network structure, an optimization method for the network structure that meets the probability requirement is determined among the multiple optimization methods.
8. The method according to claim 1, characterized in that The updating of the network structure of the neural network according to the optimization method for the network structure to obtain an optimized network structure includes: Determining operation information, size of network layers, and number of network layers in the optimization method; Replacing the operation information, the size of the network layer, and the number of network layers in the network structure of the neural network with the operation information, the size of the network layer, and the number of network layers in the optimization method to obtain an optimized network structure; The size of the network layer includes at least one of the following: the size of the convolution kernel and the size of the pooling layer.
9. The method according to claim 1, characterized in that: The performing performance evaluation on the optimized network structure and updating the parameters of the network structure optimizer according to the evaluation result includes: Performing visualization processing on the optimized network structure and the network structure of the neural network respectively, and obtaining visualization results corresponding to the optimized network structure and the network structure of the neural network; In response to the adjustment operation corresponding to the visualization result, updating the parameters of the network structure optimizer; The performing performance evaluation on the optimized network structure and updating the parameters of the network structure optimizer according to the evaluation result includes: Determining the accuracy of the optimized network structure relative to the network structure of the neural network based on the optimized network structure and the network structure of the neural network; Based on the accuracy, construct a loss function of the network structure optimizer; The parameters of the network structure optimizer are updated until the loss function converges.
10. A method for optimizing the network structure of a neural network, characterized in that: A network structure optimizer trained by a training method for a network structure optimizer of a neural network as claimed in any one of claims 1 to 9; The method comprises: Extracting features of the network structure of the neural network by the network structure optimizer to obtain feature information corresponding to the network structure; Predicting the characteristic information by the network structure optimizer to determine an optimization method for the network structure; The network structure of the neural network is updated according to the optimization method for the network structure to obtain an optimized network structure; the optimized network structure is used for image recognition or speech recognition.
11. The method according to claim 10, characterized in that The updating of the network structure of the neural network according to the optimization method for the network structure to obtain an optimized network structure includes: Determining operation information, size of network layers, and number of network layers in the optimization method; Replacing the operation information, the size of the network layer, and the number of network layers in the network structure of the neural network with the operation information, the size of the network layer, and the number of network layers in the optimization method to obtain an optimized network structure; The operation information includes at least one of the following: a convolution operation, a jump connection operation, a pooling operation, and an empty connection operation; The size of the network layer includes at least one of the following: the size of the convolution kernel and the size of the pooling layer.
12. A training device for a network structure optimizer of a neural network, characterized in that: The device comprises: A first extraction module is used to extract features of the network structure of the neural network through the network structure optimizer to obtain feature information corresponding to the network structure, wherein the feature information is obtained by processing node information and edge information in a directed graph of the network structure, the node information is an input feature or an output feature in the network structure, and the edge information is operation information in the network structure; A first prediction module, used to predict the characteristic information through the network structure optimizer and determine multiple optimization methods for the network structure; A first optimization module, used to update the network structure of the neural network according to the optimization method for the network structure to obtain an optimized network structure; the optimized network structure is used for image recognition or speech recognition; The training module is used to perform performance evaluation on the optimized network structure and update the parameters of the network structure optimizer according to the evaluation results.
13. A device for optimizing the network structure of a neural network, characterized in that: A network structure optimizer trained by a training method for a network structure optimizer of a neural network as claimed in any one of claims 1 to 9; The device comprises: A second extraction module is used to extract features from the network structure of the neural network through the network structure optimizer to obtain feature information corresponding to the network structure, wherein the feature information is obtained by processing the node information and the edge information in the directed graph of the network structure, the node information is the input feature or the output feature in the network structure, and the edge information is the operation information in the network structure; A second prediction module, used to predict the characteristic information through the network structure optimizer and determine an optimization method for the network structure; The second optimization module is used to update the network structure of the neural network according to the optimization method for the network structure to obtain an optimized network structure; the optimized network structure is used for image recognition or speech recognition.
14. A training device for a network structure optimizer of a neural network, characterized in that: The device comprises: A memory for storing executable instructions; A processor, used to implement the training method of the network structure optimizer of the neural network according to any one of claims 1 to 9 when executing the executable instructions stored in the memory.
15. A storage medium, characterized in that: Executable instructions are stored for causing the processor to execute and implement the training method of the network structure optimizer of the neural network described in any one of claims 1 to 9 or the optimization method of the network structure of the neural network described in any one of claims 10 to 11.
