WO2023246819A1 - Model training method and related device - Google Patents

Model training method and related device Download PDF

Info

Publication number
WO2023246819A1
WO2023246819A1 PCT/CN2023/101527 CN2023101527W WO2023246819A1 WO 2023246819 A1 WO2023246819 A1 WO 2023246819A1 CN 2023101527 W CN2023101527 W CN 2023101527W WO 2023246819 A1 WO2023246819 A1 WO 2023246819A1
Authority
WO
WIPO (PCT)
Prior art keywords
processing result
neural network
target
reinforcement learning
data
Prior art date
Application number
PCT/CN2023/101527
Other languages
French (fr)
Chinese (zh)
Inventor
和煦
李栋
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2023246819A1 publication Critical patent/WO2023246819A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods

Definitions

  • This application relates to the field of artificial intelligence, and in particular to a model training method and related equipment.
  • Artificial Intelligence is a theory, method, technology and application system that simulates, extends and expands human intelligence through digital computers or machines controlled by digital computers, perceives the environment, acquires knowledge and uses knowledge to obtain the best results.
  • artificial intelligence is a branch of computer science that attempts to understand the nature of intelligence and produce a new class of intelligent machines that can respond in a manner similar to human intelligence.
  • Artificial intelligence is the study of the design principles and implementation methods of various intelligent machines, so that the machines have the functions of perception, reasoning and decision-making.
  • Research in the field of artificial intelligence includes robotics, natural language processing, computer vision, decision-making and reasoning, human-computer interaction, recommendation and search, basic AI theory, etc.
  • Reinforcement learning is an important machine learning method in the field of artificial intelligence. It has many applications in fields such as autonomous driving, intelligent control of robots, and analysis and prediction. Specifically, the main problem to be solved through reinforcement learning is how smart devices directly interact with the environment to learn the skills used to perform specific tasks in order to maximize long-term rewards for specific tasks. In the application process of reinforcement learning algorithms, it is often necessary to interact with the online environment to obtain data and conduct training. The general approach is to model real scenes in the real world and generate an online environment for virtual simulation. In this case, if there is a slight difference between the training environment and the real environment that needs to be deployed, it is likely to cause the trained algorithm to fail, causing the performance in the real scenario to be lower than expected.
  • the above problems can be alleviated by improving the robustness of reinforcement learning algorithms.
  • One method is to introduce imaginary interference in the virtual environment, train the reinforcement learning algorithm under the interference, improve its ability to deal with interference, and enhance the robustness and generalization of the algorithm.
  • you can set up an adversarial agent.
  • the data output by the adversarial agent can perform tasks together with the output data of the reinforcement learning model, and the data output by the anti-agent can serve as interference in executing the target task.
  • the adversarial agent can only output a certain kind of specific interference (for example, for robot control, a specific range of force can be applied to a certain joint as Interference), when the changes in the real environment are inconsistent with the imaginary interference (that is, the interference output by the anti-agent), the algorithm will be less effective and less robust.
  • a certain kind of specific interference for example, for robot control, a specific range of force can be applied to a certain joint as Interference
  • This application provides a model training method that can improve the training effect and generalization of the model.
  • this application provides a model training method.
  • the method includes: processing first data through a first reinforcement learning model to obtain a first processing result; wherein the first data indicates the state of the target object. , the first processing result is used as control information when performing a target task on the target object; the first data is processed through the first target neural network to obtain a second processing result; wherein, the first The second processing result is used as interference information when executing the target task.
  • the first target neural network is selected from a plurality of first neural networks, and each of the first neural networks is a pair of the first initial neural network.
  • the first reinforcement learning model may be an initialized model or the output of an iteration in the model training process.
  • the reinforcement learning models in the embodiments of this application include but are not limited to deep neural networks, Bayesian neural networks, etc.
  • the first data can be processed through the first reinforcement learning model to obtain the first processing result.
  • the first processing result is used as control information when performing a target task on the target object.
  • the target task is the attitude control of the robot, and the first processing result is the attitude control information of the robot; or,
  • the target task is automatic driving of the vehicle, and the first processing result is the driving control information of the vehicle.
  • an adversarial agent for outputting interference information can be trained.
  • the interference information only performs one kind of interference for the target task.
  • multiple adversarial agents for outputting interference information can be trained.
  • Adversarial agents that interfere with information are different adversarial agents.
  • the interference information output by the agent can perform different types of interference on the target task.
  • training the adversarial agent not only the adversarial agent obtained in the latest iteration is used to output interference on the target task, but also Use the historical training results of historical adversarial agents (adversarial agents obtained during the historical iteration process) to output interference for the target task, so that more effective interference for the target task can be obtained that is adapted to different scenarios. Thereby improving the training effect and generalization of the model.
  • the first data is status information related to the robot; the target task is attitude control of the robot, and the first processing result is attitude control information of the robot.
  • the robot-related status information may include but is not limited to the robot's position and speed, and information related to the scene it is in (such as obstacle information).
  • the robot's position and speed may include the status of each joint. (position, angle, speed, acceleration, etc.) and other information.
  • the first reinforcement learning model can obtain the attitude control information of the robot based on the input data.
  • the attitude control information can include the control information of each joint of the robot, and the attitude control task of the robot can be performed based on the attitude control information. .
  • the first data is vehicle-related status information
  • the target task is automatic driving of the vehicle
  • the first processing result is the driving control information of the vehicle.
  • the vehicle-related status information may include but is not limited to the vehicle's position, speed, and information related to the scene in which it is located (such as driving road information, obstacle information, pedestrian information, and surrounding vehicle information). ).
  • the first reinforcement learning model can obtain the driving control information of the vehicle based on the input data.
  • the driving control information can include the vehicle's speed, direction, driving trajectory and other information.
  • the method further includes: selecting the first target neural network from the plurality of first neural networks.
  • the first target neural network is selected from a plurality of first neural networks based on a first selection probability corresponding to each of the plurality of first neural networks. . That is to say, each first neural network can be configured with a corresponding probability (ie, the first selection probability described above).
  • the first neural network can be selected based on multiple first neural networks. A probability distribution corresponding to a neural network is used to sample and the network is selected based on the sampling results.
  • the processing result obtained by each first neural network processing data is used as interference when executing the target task, and the first selection probability is the same as the processing result output by the corresponding first neural network.
  • the degree of interference with the target task is positively correlated.
  • the first selection probability can be a trainable parameter.
  • a reward value can be obtained.
  • the reward value can represent the performance of the data output by the reinforcement learning model in executing the target.
  • the excellence in the task can also represent the degree of interference of the interference information output by the adversarial agent on the target task, and the probability distribution corresponding to the first neural network can be updated based on the reward value, so that the first selection probability is consistent with the corresponding
  • the degree of interference of the processing result output by the first neural network to the target task is positively correlated.
  • the above probability distribution can be a Nash equilibrium distribution.
  • the probability distribution can be calculated through Nash equilibrium based on the reward value obtained when performing the target task based on the data and interference information obtained during the feedforward of the reinforcement learning model. During the iteration process, the probability distribution can be updated.
  • the embodiment of the present application controls the behavior space of the adversarial agent and changes the interference intensity of the adversarial agent, making the reinforcement learning strategy robust to both strong and weak interference.
  • the reinforcement learning strategy is more robust to interference from different strategies.
  • updating the first reinforcement learning model according to the third processing result includes:
  • the reward value corresponding to the target task is obtained
  • the method also includes:
  • the first selection probability corresponding to the first target neural network is updated.
  • the reinforcement learning strategy and the updated strategy of the adversarial agent can be added to the Nash equilibrium matrix, and the Nash equilibrium can be calculated to obtain the reinforcement learning and adversarial agents.
  • Nash equilibrium distribution Specifically, updating the first reinforcement learning model according to the first processing result and the second processing result includes: obtaining the target according to the first processing result and the second processing result. The reward value corresponding to the task; the first reinforcement learning model is updated according to the reward value; further, the first selection probability corresponding to the first target neural network can be updated according to the reward value.
  • multiple adversarial agents can be trained, and for each adversarial agent in the multiple adversarial agents, multiple adversarial agents can be trained from Select the adversarial agent that interferes with the reinforcement learning model from the iteration results.
  • the method further includes:
  • the first data is processed through a second target neural network to obtain a fourth processing result; wherein the fourth processing result is used as interference information when executing the target task, and the second target neural network is Selected from a plurality of second neural networks, each second neural network is an iterative result obtained from the iterative training process of a second initial neural network; the first initial neural network and the second initial neural network are Neural networks are different;
  • Executing the target task according to the first processing result and the second processing result to obtain a third processing result includes:
  • the target task is executed to obtain a third processing result.
  • the interference types of the second processing result and the fourth processing result are different.
  • the interference type may be a category of interference applied when performing the target task, such as applying force, applying torque, adding obstacles, changing road conditions, changing weather, etc.
  • the interference objects of the second processing result and the fourth processing result are different.
  • the robot may include multiple joints, and applying force to different joints or different joint groups may be considered to be different interference objects. That is, the second processing result and the fourth processing result are forces applied to different joints or different joint groups.
  • the first target neural network is used to determine the second processing result from a first numerical range according to the first data
  • the second target neural network is used to determine the second processing result according to the first numerical range.
  • the first data determines the fourth processing result from a second numerical range
  • the second numerical range is different from the first numerical range.
  • the second processing result and the fourth processing result are both forces exerted on the robot joints.
  • the maximum value of the force determined by the first target neural network is A1
  • the maximum value of the force determined by the second target neural network is The maximum value of is A2, A1 and A2 are different.
  • the reinforcement learning model participating in the training process in the current round can also be selected from the historical iteration results of the reinforcement learning model. For example, it can be based on probability sampling. For similarities, refer to the process of sampling the adversarial agent in the above embodiment.
  • the second data can be processed through a second reinforcement learning model to obtain a fifth processing result; wherein the second reinforcement learning model is derived from the updated first reinforcement learning model.
  • each of the reinforcement learning models is an iterative result obtained from the iterative training process of the initial reinforcement learning model; the second data indicates the state of the target object, and the third
  • the fifth processing result is used as control information when performing the target task on the target object; the second data is processed through a third target neural network to obtain a sixth processing result; the third target neural network Belonging to the plurality of first neural networks; the sixth processing result is used as interference information when executing the target task; executing the target task according to the fifth processing result and the sixth processing result, Obtain a seventh processing result; update the third target neural network according to the seventh processing result to obtain an updated third target neural network.
  • the second reinforcement learning model may be selected from the plurality of reinforcement learning models.
  • selecting the second reinforcement learning model from the plurality of reinforcement learning models includes: based on the second selection probability corresponding to each reinforcement learning model in the plurality of reinforcement learning models. , selecting the second reinforcement learning model from a plurality of reinforcement learning models.
  • the second selection probability is positively related to the positive execution effect of the processing result output by the corresponding reinforcement learning model when executing the target task.
  • a reward value can be obtained.
  • the reward value can represent the excellence of the data output by the reinforcement learning model in performing the target task, and can be used to strengthen the reinforcement based on the reward value.
  • the probability distribution corresponding to the learning model is updated so that the second selection probability is positively related to the positive execution effect of the processing result output by the corresponding reinforcement learning model when executing the target task.
  • the historical strategy of the reinforcement learning agent can be sampled and selected from the historical strategy collection of the reinforcement learning agent according to the Nash equilibrium distribution for use in the strategy update of the countermeasure agent.
  • deploy the selected reinforcement learning strategy and the current adversarial agent strategy perform sampling, and obtain the required training samples. Use the obtained training samples to train the adversarial agent strategy.
  • this application provides a model training device, which includes:
  • the data processing module is used to process the first data through the first reinforcement learning model to obtain the first processing result; wherein the first data indicates the state of the target object, and the first processing result is used as the first processing result in the Control information when performing target tasks on the target object;
  • the first data is processed through a first target neural network to obtain a second processing result; wherein the second processing result is used as interference information when executing the target task, and the first target neural network is Selected from a plurality of first neural networks, each first neural network is an iterative result obtained from the process of iterative training of the first initial neural network;
  • a model update module configured to update the first reinforcement learning model according to the third processing result to obtain an updated first reinforcement learning model.
  • an adversarial agent for outputting interference information can be trained.
  • the interference information only performs one kind of interference for the target task.
  • multiple adversarial agents for outputting interference information can be trained.
  • the interference information output by different adversarial agents can interfere with different types of target tasks.
  • training adversarial agents not only the adversarial agents obtained in the latest iteration are used to output For interference on the target task, the historical training results of historical adversarial agents (adversarial agents obtained during the historical iteration process) can also be used to output interference on the target task, so that the system can be adapted to different scenarios. More effective interference with the target task, thereby improving the training effect and generalization of the model.
  • the target object is a robot; the target task is the attitude control of the robot, and the first processing result is the attitude control information of the robot; or,
  • the target object is a vehicle; the target task is automatic driving of the vehicle; and the first processing result is the driving control information of the vehicle.
  • the device further includes:
  • a network selection module configured to select the first target neural network from the plurality of first neural networks.
  • the first target neural network is selected from a plurality of first neural networks based on a first selection probability corresponding to each of the plurality of first neural networks.
  • the processing result obtained by each first neural network processing data is used as interference when executing the target task, and the first selection probability is the same as the processing result output by the corresponding first neural network.
  • the degree of interference with the target task is positively correlated.
  • model update module is specifically used to:
  • the reward value corresponding to the target task is obtained
  • the model update module is also used to:
  • the first selection probability corresponding to the first target neural network is updated.
  • the data processing module is also used to:
  • the first data is processed through a second target neural network to obtain a fourth processing result; wherein the fourth processing result is used as interference information when executing the target task, and the second target neural network is Selected from a plurality of second neural networks, each second neural network is an iterative result obtained from the iterative training process of a second initial neural network; the first initial neural network and the second initial neural network are Neural networks are different;
  • the data processing module is specifically used for:
  • the target task is executed to obtain a third processing result.
  • the interference types of the second processing result and the fourth processing result are different; or,
  • the interference objects of the second processing result and the fourth processing result are different; or,
  • the first target neural network is used to determine the second processing result from a first numerical range according to the first data
  • the second target neural network is used to determine the second processing result from a second numerical value according to the first data.
  • the fourth processing result is determined within a range, and the second numerical range is different from the first numerical range.
  • the data processing module is also used to:
  • each of the reinforcement learning models is an iterative result obtained from the iterative training process of the initial reinforcement learning model;
  • the second data indicates the state of the target object, and the fifth processing result is used as the Control information when performing the target task on the target object;
  • the second data is processed through a third target neural network to obtain a sixth processing result;
  • the third target neural network belongs to the plurality of first neural networks;
  • the sixth processing result is used as the basis for executing the Interfering information during the target task;
  • the model update module is also used to:
  • the third target neural network is updated to obtain an updated third target neural network.
  • the network selection module is also used to:
  • the second reinforcement learning model is selected from the plurality of reinforcement learning models.
  • the network selection module is specifically used to:
  • this application provides a data processing method, including:
  • the first data is processed through the first reinforcement learning model to obtain a first processing result; the first processing result is used as the control information of the target object;
  • the first reinforcement learning model is updated by a reward value during an iteration of training, and the reward value is interference information applied when executing the target task according to the control information output by the feedforward process of the first reinforcement learning model. Obtained, the interference information is obtained through the feedforward process of the target neural network, the target neural network is selected from multiple neural networks, and each of the neural networks is one obtained by iteratively training the initial neural network. Iteration results;
  • a target task is performed on the target object.
  • the target object is a robot; the target task is the attitude control of the robot, and the first processing result is the attitude control information of the robot; or,
  • the target object is a vehicle; the target task is automatic driving of the vehicle; and the first processing result is the driving control information of the vehicle.
  • the first neural network is selected from a plurality of first neural networks based on a first selection probability corresponding to each neural network in the plurality of neural networks.
  • the processing results obtained by each neural network processing data are used as interference when executing the target task, and the first selection probability and the processing results output by the corresponding neural network have a positive impact on the target.
  • the degree of interference of the task is positively related.
  • a model training device which may include a memory, a processor, and a bus system.
  • the memory is used to store programs
  • the processor is used to execute programs in the memory to perform the first aspect as described above. and any optional methods.
  • embodiments of the present application provide a data processing device, which may include a memory, a processor, and a bus system, wherein the memory is used to store programs, and the processor is used to execute the programs in the memory to perform the third aspect as described above. and any optional methods.
  • embodiments of the present application provide a computer-readable storage medium.
  • a computer program is stored in the computer-readable storage medium. When it is run on a computer, it causes the computer to execute the above-mentioned first aspect and any of its options. method, or the above third aspect and any optional method thereof.
  • embodiments of the present application provide a computer program product including instructions that, when run on a computer, cause the computer to execute the above-mentioned first aspect and any of its optional methods, or the above-mentioned third aspect and any of its optional methods. Any optional method.
  • this application provides a chip system that includes a processor to support the model training device to implement some or all of the functions involved in the above aspects, for example, sending or processing data involved in the above methods. ; or, information.
  • the chip system also includes a memory, which is used to save necessary program instructions and data for executing the device or training the device.
  • the chip system may be composed of chips, or may include chips and other discrete devices.
  • Embodiments of the present application provide a model training method.
  • the method includes: processing first data through a first reinforcement learning model to obtain a first processing result; wherein the first data indicates the state of the target object, and the first data indicates the state of the target object.
  • the first processing result is used as control information when performing a target task on the target object; the first data is processed through the first target neural network to obtain a second processing result; wherein, the second processing The result is used as interference information when executing the target task.
  • the first target neural network is selected from a plurality of first neural networks, and each of the first neural networks iterates the first initial neural network.
  • Figure 1 is a schematic diagram of an application architecture
  • Figure 2 is a schematic diagram of an application architecture
  • Figure 3 is a schematic diagram of an application architecture
  • Figure 4 is a schematic diagram of an embodiment of a model training method provided by an embodiment of the present application.
  • Figure 5 is a schematic diagram of a software architecture provided by an embodiment of the present application.
  • Figure 6 is a schematic diagram of an embodiment of a model training method provided by an embodiment of the present application.
  • Figure 7 is a schematic diagram of an embodiment of a model training device provided by an embodiment of the present application.
  • Figure 8 is a schematic structural diagram of an execution device provided by an embodiment of the present application.
  • Figure 9 is a schematic structural diagram of a server provided by an embodiment of the present application.
  • Figure 10 is a schematic structural diagram of a chip provided by an embodiment of the present application.
  • the terms “substantially”, “about” and similar terms are used as terms of approximation, not as terms of degree, and are intended to take into account measurements or values that would be known to one of ordinary skill in the art. The inherent bias in calculated values.
  • the use of “may” when describing embodiments of the present invention refers to “one or more possible embodiments.”
  • the terms “use”, “using”, and “used” may be deemed to be the same as the terms “utilize”, “utilizing”, and “utilize”, respectively. Synonymous with “utilized”.
  • the term “exemplary” is intended to refer to an example or illustration.
  • Figure 1 shows a structural schematic diagram of the artificial intelligence main framework.
  • the following is from the “intelligent information chain” (horizontal axis) and “IT value chain” ( The above artificial intelligence theme framework is elaborated on the two dimensions of vertical axis).
  • the "intelligent information chain” reflects a series of processes from data acquisition to processing. For example, it can be the general process of intelligent information perception, intelligent information representation and formation, intelligent reasoning, intelligent decision-making, intelligent execution and output. In this process, the data has gone through the condensation process of "data-information-knowledge-wisdom".
  • the "IT value chain” reflects the value that artificial intelligence brings to the information technology industry, from the underlying infrastructure of human intelligence and information (providing and processing technology implementation) to the systematic industrial ecological process.
  • Infrastructure provides computing power support for artificial intelligence systems, enables communication with the external world, and supports it through basic platforms.
  • computing power is provided by smart chips (hardware acceleration chips such as CPU, NPU, GPU, ASIC, FPGA, etc.);
  • the basic platform includes distributed computing framework and network and other related platform guarantees and support, which can include cloud storage and Computing, interconnection networks, etc.
  • sensors communicate with the outside world to obtain data, which are provided to smart chips in the distributed computing system provided by the basic platform for calculation.
  • Data from the upper layer of the infrastructure is used to represent data sources in the field of artificial intelligence.
  • the data involves graphics, images, voice, and text, as well as IoT data of traditional devices, including business data of existing systems and sensory data such as force, displacement, liquid level, temperature, and humidity.
  • Data processing usually includes data training, machine learning, deep learning, search, reasoning, decision-making and other methods.
  • machine learning and deep learning can perform symbolic and formal intelligent information modeling, extraction, preprocessing, training, etc. on data.
  • Reasoning refers to the process of simulating human intelligent reasoning in computers or intelligent systems, using formal information to perform machine thinking and problem solving based on reasoning control strategies. Typical functions are search and matching.
  • Decision-making refers to the process of decision-making after intelligent information is reasoned, and usually provides functions such as classification, sorting, and prediction.
  • some general capabilities can be formed based on the results of further data processing, such as algorithms or a general system, such as translation, text analysis, computer vision processing, speech recognition, and image processing. identification, etc.
  • Intelligent products and industry applications refer to the products and applications of artificial intelligence systems in various fields. They are the encapsulation of overall artificial intelligence solutions, productizing intelligent information decision-making and realizing practical applications. Its application fields mainly include: intelligent terminals, intelligent transportation, Smart healthcare, autonomous driving, smart cities, etc.
  • the parts grabbing operation originally completed by humans can be completed by an intelligent robotic arm.
  • the intelligent robotic arm needs to be equipped with Grasping skills and neural networks for grasping skills, in which different grasping skills can have different grabbing angles, displacements of intelligent robotic arms, etc.; as another example, for example, in the field of automatic cooking, the cooking operation is originally completed by humans. It can be completed by an intelligent robotic arm.
  • the intelligent robotic arm needs to be equipped with cooking skills such as raw material grabbing skills, stir-frying skills, and neural networks for cooking skills. Other application scenarios are not exhaustive here.
  • FIG. 2 is a schematic diagram of a computing system that performs model training in an embodiment of the present application.
  • the computing system includes a terminal device 102 (exemplarily, the terminal device 102 may not be included) and a server 130 (which may also be called a central node) communicatively coupled through a network.
  • the terminal device 102 may be any type of computing device, such as, for example, a personal computing device (eg, a laptop or desktop computer), a mobile computing device (eg, a smartphone or tablet), a game console or controller , wearable computing devices, embedded computing devices, or any other type of computing device.
  • the terminal device 102 may include a processor 112 and a memory 114.
  • Processor 112 may be any suitable processing device (e.g., processor core, microprocessor, application specific integrated circuit (ASIC), field programmable gate array (FPGA), controller , microcontroller, etc.).
  • the memory 114 may include, but is not limited to, Random Access Memory (RAM), Read-Only Memory (ROM), Erasable Programmable Read Only Memory (EPROM), Or portable read-only memory (Compact Disc Read-Only Memory, CD-ROM).
  • the memory 114 may store data 116 and instructions 118 executed by the processor 112 to cause the terminal device 102 to perform operations.
  • memory 114 may store one or more models 120 .
  • model 120 may be or may additionally include various machine learning models, such as neural networks (eg, deep neural networks) or other types of machine learning models, including nonlinear models and/or linear models.
  • Neural networks may include feedforward neural networks, recurrent neural networks (eg, long short-term memory recurrent neural networks), convolutional neural networks, or other forms of neural networks.
  • one or more models 120 may be received from server 130 over network 180, stored in memory 114, and then used by one or more processors 112 or otherwise implemented.
  • Terminal device 102 may also include one or more user input components 122 that receive user input.
  • user input component 122 may be a touch-sensitive component (eg, a touch-sensitive display screen or touch pad) that is sensitive to the touch of a user input object (eg, a finger or stylus).
  • Touch-sensitive components can be used to implement virtual keyboards.
  • Other example user input components include a microphone, a traditional keyboard, or other device through which a user can provide user input.
  • the terminal device 102 may also include a communication interface 123.
  • the terminal device 102 may be communicatively connected to the server 130 through the communication interface 123.
  • the server 130 may include a communication interface 133.
  • the terminal device 102 may be communicatively connected to the communication interface 133 of the server 130 through the communication interface 123. In this way, data interaction between the terminal device 102 and the server 130 is achieved.
  • Server 130 may include processor 132 and memory 134.
  • the processor 132 may be any suitable processing device (eg, processor core, microprocessor, application specific integrated circuit (ASIC), field programmable gate array (FPGA), controller, microcontroller, etc.).
  • the memory 134 may include, but is not limited to, random access memory (Random Access Memory, RAM), read-only memory (Read-Only Memory, ROM), erasable and programmable memory. Read-only memory (Erasable Programmable Read Only Memory, EPROM), or portable read-only memory (Compact Disc Read-Only Memory, CD-ROM).
  • Memory 134 may store data 136 and instructions 138 for execution by processor 132 to cause server 130 to perform operations.
  • memory 134 may store one or more machine learning models 140.
  • model 140 may be or may additionally include various machine learning models.
  • Example machine learning models include neural networks or other multi-layered nonlinear models.
  • Example neural networks include feedforward neural networks, deep neural networks, recurrent neural networks, and convolutional neural networks.
  • model training method in the embodiment of the present application involves AI-related operations.
  • the instruction execution architecture of the terminal device and server is not limited to the processor-memory architecture shown in Figure 2.
  • the system architecture provided by the embodiment of the present application will be introduced in detail below with reference to Figure 3 .
  • FIG 3 is a schematic diagram of the system architecture provided by an embodiment of the present application.
  • the system architecture 500 includes an execution device 510, a training device 520, a database 530, a client device 540, a data storage system 550 and a data collection system 560.
  • the execution device 510 includes a computing module 511, an I/O interface 512, a preprocessing module 513 and a preprocessing module 514.
  • the target model/rule 501 may be included in the calculation module 511, and the preprocessing module 513 and the preprocessing module 514 are optional.
  • Data collection device 560 is used to collect training samples.
  • the training samples may be first data, second data, etc., wherein the first data and the second data may be state information related to the target object (such as a robot, a vehicle, etc.), state information related to the vehicle, etc.
  • the data collection device 560 stores the training samples into the database 530 .
  • the training device 520 can maintain training samples based on the database 530, and the neural network to be trained (such as the reinforcement learning model and the target neural network in the embodiment of the present application, where the target neural network is used as an adversarial agent of the reinforcement learning model) , to get the target model/rule 501.
  • the neural network to be trained such as the reinforcement learning model and the target neural network in the embodiment of the present application, where the target neural network is used as an adversarial agent of the reinforcement learning model
  • the training samples maintained in the database 530 are not necessarily collected from the data collection device 560, and may also be received from other devices.
  • the training device 520 may not necessarily train the target model/rules 501 based entirely on the training samples maintained by the database 530. It may also obtain training samples from the cloud or other places for model training. The above description should not be used as a guarantee for this application. Limitations of Examples.
  • the target model/rules 501 trained according to the training device 520 can be applied to different systems or devices, such as the execution device 510 shown in Figure 3.
  • the execution device 510 can be a terminal, such as a mobile phone terminal, a tablet computer, and a notebook.
  • AR augmented reality
  • VR virtual reality
  • the target model/rule 501 can be used to achieve target tasks, such as driving control in autonomous driving, attitude control on robots, etc.
  • the training device 520 can transfer the trained model to the execution device 510 .
  • the execution device 510 may be the above-mentioned target object.
  • the execution device 510 is configured with an input/output (I/O) interface 512 for data interaction with external devices.
  • the user can input data to the I/O interface 512 through the client device 540, or execute Device 510 can automatically collect input data.
  • the preprocessing module 513 and the preprocessing module 514 are used to perform preprocessing according to the input data received by the I/O interface 512. It should be understood that there may be no preprocessing module 513 and 514 or only one preprocessing module. When the preprocessing module 513 and the preprocessing module 514 do not exist, the computing module 511 can be directly used to process the input data.
  • the execution device 510 When the execution device 510 preprocesses input data, or when the calculation module 511 of the execution device 510 performs calculations and other related processes, the execution device 510 can call data, codes, etc. in the data storage system 550 for corresponding processing. , the data, instructions, etc. obtained by corresponding processing can also be stored in the data storage system 550.
  • the I/O interface 512 provides the processing results to the client device 540, thereby providing them to the user, or performing control operations based on the processing results.
  • the user can manually set the input data, and the "manually set input data" can be operated through the interface provided by the I/O interface 512 .
  • the client device 540 can automatically send input data to the I/O interface 512. If requiring the client device 540 to automatically send the input data requires the user's authorization, the user can set corresponding permissions in the client device 540.
  • the user can view the results output by the execution device 510 on the client device 540, and the specific presentation form may be display, sound, action, etc.
  • the client device 540 can also be used as a data collection terminal to collect the input data and output I/O of the input I/O interface 512 as shown in the figure.
  • the output result of the interface 512 is used as new sample data and stored in the database 530 .
  • the I/O interface 512 directly uses the input data input to the I/O interface 512 and the output result of the output I/O interface 512 as a new sample as shown in the figure.
  • the data is stored in database 530.
  • Figure 3 is only a schematic diagram of a system architecture provided by an embodiment of the present application.
  • the positional relationship between the devices, devices, modules, etc. shown in the figure does not constitute any limitation.
  • the data The storage system 550 is an external memory relative to the execution device 510. In other cases, the data storage system 550 can also be placed in the execution device 510. It should be understood that the above execution device 510 may be deployed in the client device 540.
  • the above-mentioned training device 520 can obtain the code stored in the memory (not shown in Figure 3, which can be integrated with the training device 520 or deployed separately from the training device 520) to implement the model training in the embodiment of the present application. Related steps.
  • the training device 520 may include hardware circuits (such as application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), general-purpose processors, digital signal processors (digital signal processing, DSP, microprocessor or microcontroller, etc.), or a combination of these hardware circuits.
  • ASICs application specific integrated circuits
  • FPGAs field-programmable gate arrays
  • DSP digital signal processors
  • the training device 520 can be a hardware system with the function of executing instructions, such as a CPU, DSP, etc., or a combination of other hardware circuits.
  • a hardware system with the function of executing instructions such as ASIC, FPGA, etc., or a combination of the above-mentioned hardware systems without the function of executing instructions and a hardware system with the function of executing instructions.
  • the training device 520 can be a combination of a hardware system that does not have the function of executing instructions and a hardware system that has the function of executing instructions. Some of the steps related to model training provided by the embodiments of the present application can also be implemented by the training device 520 that does not have the function of executing instructions. It is implemented by the hardware system that executes the instruction function, which is not limited here.
  • the neural network can be composed of neural units.
  • the neural unit can refer to an operation unit that takes xs (ie, input data) and intercept 1 as input.
  • the output of the operation unit can be:
  • s 1, 2,...n, n is a natural number greater than 1
  • Ws is the weight of xs
  • b is the bias of the neural unit.
  • f is the activation function of the neural unit, which is used to introduce nonlinear characteristics into the neural network to convert the input signal in the neural unit into an output signal.
  • the output signal of this activation function can be used as the input of the next convolutional layer, and the activation function can be a sigmoid function.
  • a neural network is a network formed by connecting multiple above-mentioned single neural units together, that is, the output of one neural unit can be the input of another neural unit.
  • the input of each neural unit can be connected to the local receptive field of the previous layer to extract the features of the local receptive field.
  • the local receptive field can be an area composed of several neural units.
  • Deep Neural Network also known as multi-layer neural network
  • DNN Deep Neural Network
  • the neural network inside DNN can be divided into three categories: input layer, hidden layer, and output layer.
  • the first layer is the input layer
  • the last layer is the output layer
  • the layers in between are hidden layers.
  • the layers are fully connected, that is to say, any neuron in the i-th layer must be connected to any neuron in the i+1-th layer.
  • the coefficient from the k-th neuron in layer L-1 to the j-th neuron in layer L is defined as It should be noted that the input layer has no W parameter.
  • more hidden layers make the network more capable of describing complex situations in the real world. Theoretically, a model with more parameters has higher complexity and greater "capacity", which means it can complete more complex learning tasks.
  • Training a deep neural network is the process of learning the weight matrix. The ultimate goal is to obtain the weight matrix of all layers of the trained deep neural network (a weight matrix formed by the vectors W of many layers).
  • Reinforcement learning also known as reinforcement learning, evaluation learning or reinforcement learning, is one of the paradigms and methodologies of machine learning. It is used to describe and solve the interaction process between the agent and the environment. The problem of learning strategies to maximize returns or achieve specific goals.
  • a common model for reinforcement learning is the standard Markov decision process (MDP).
  • reinforcement learning can be divided into model-based reinforcement learning (model-based RL) and model-free reinforcement learning (model-free RL), as well as active reinforcement learning (active RL) and passive reinforcement learning (passive RL).
  • Variants of reinforcement learning include inverse reinforcement learning, hierarchical reinforcement learning, and reinforcement learning for partially observable systems.
  • the algorithms used to solve reinforcement learning problems can be divided into two categories: policy search algorithms and value function algorithms. Deep learning models can be used in reinforcement learning to form deep reinforcement learning.
  • the convolutional neural network can use the error back propagation (BP) algorithm to modify the size of the parameters in the initial super-resolution model during the training process, so that the reconstruction error loss of the super-resolution model becomes smaller and smaller.
  • BP error back propagation
  • forward propagation of the input signal until the output will produce an error loss
  • the parameters in the initial super-resolution model are updated by back-propagating the error loss information, so that the error loss converges.
  • the backpropagation algorithm is a backpropagation movement dominated by error loss, aiming to obtain the optimal parameters of the super-resolution model, such as the weight matrix.
  • non-cooperative game equilibrium Also known as non-cooperative game equilibrium, it is an important term in game theory. In a game process, regardless of the other party's strategy choice, one party will choose a certain strategy, and this strategy is called a dominant strategy. If any player chooses the optimal strategy when the strategies of all other players are determined, then this combination is defined as a Nash equilibrium.
  • a strategy combination is called a Nash equilibrium.
  • each player's equilibrium strategy is to maximize his or her expected return, at the same time, all other players also follow this strategy.
  • Reinforcement learning also known as reinforcement learning, evaluation learning or reinforcement learning, is one of the paradigms and methodologies of machine learning. It is used to describe and solve the problem of how an agent learns during its interaction with the environment. Strategies to maximize returns or achieve specific goals.
  • a common model for reinforcement learning is the standard Markov decision process (MDP).
  • reinforcement learning can be divided into model-based reinforcement learning (model-based RL) and model-free reinforcement learning (model-free RL), as well as active reinforcement learning (active RL) and passive reinforcement learning (passive RL).
  • Variants of reinforcement learning include inverse reinforcement learning, hierarchical reinforcement learning, and reinforcement learning for partially observable systems.
  • the algorithms used to solve reinforcement learning problems can be divided into two categories: policy search algorithms and value function algorithms. Deep learning models can be used in reinforcement learning to form deep reinforcement learning.
  • Agent is a concept in the field of artificial intelligence. Any entity that can think independently and interact with the environment can be abstracted into an agent. The basic characteristics of an intelligent agent are: the intelligent agent can react according to changes in the environment, and then automatically adjust its behavior and status. Different intelligent agents can also interact with other intelligent agents according to their own intentions.
  • One method is to introduce imaginary interference in the virtual environment, train the reinforcement learning algorithm under the interference, improve its ability to deal with interference, and enhance the robustness and generalization of the algorithm.
  • the data output by the adversarial agent can perform tasks together with the output data of the reinforcement learning model, and the data output by the anti-agent can serve as interference in executing the target task.
  • existing training methods mainly resist certain specific interferences.
  • the algorithm effect will decrease.
  • a model training method provided by an embodiment of the present application includes:
  • the execution subject of step 401 may be a training device (for example, the training device may be a terminal device or a server).
  • the training device may be a terminal device or a server.
  • the training device can obtain the model training object (first reinforcement learning model) and the training sample (first data).
  • the first data is status information related to the robot; the target task is attitude control of the robot, and the first processing result is attitude control information of the robot.
  • the robot-related status information may include but is not limited to the robot's position and speed, and information related to the scene it is in (such as obstacle information).
  • the robot's position and speed may include the status of each joint. (position, angle, speed, acceleration, etc.) and other information.
  • the first reinforcement learning model can obtain the attitude control information of the robot based on the input data.
  • the attitude control information can include the control information of each joint of the robot, and the attitude control task of the robot can be performed based on the attitude control information. .
  • the first data is vehicle-related status information
  • the target task is automatic driving of the vehicle
  • the first processing result is the driving control information of the vehicle.
  • the vehicle-related status information may include but is not limited to the vehicle's position, speed, and information related to the scene in which it is located (such as driving road information, obstacle information, pedestrian information, and surrounding vehicle information). ).
  • the first reinforcement learning model can obtain the driving control information of the vehicle based on the input data.
  • the driving control information can include the vehicle's speed, direction, driving trajectory and other information.
  • the first reinforcement learning model may be an initialized model or the output of an iteration in the model training process.
  • the first data can be processed through the first reinforcement learning model to obtain the first processing result.
  • the first processing result is used as control information when performing a target task on the target object.
  • the target task is the attitude control of the robot, and the first processing result is the attitude control information of the robot; or,
  • the target task is automatic driving of the vehicle, and the first processing result is the driving control information of the vehicle.
  • the first processing result can be used as a hard constraint imposed on the target object when performing the target task.
  • reinforcement learning models in the embodiments of this application include but are not limited to deep neural networks, Bayesian neural networks, etc.
  • the first target neural network is selected from a plurality of first neural networks, and each first neural network is obtained by iteratively training the first initial neural network. The result of an iteration.
  • the training device can obtain an adversarial agent for the reinforcement learning model, and the adversarial agent can output interference information for the target task.
  • an adversarial agent for outputting interference information can be trained.
  • the interference information only performs one kind of interference for the target task.
  • multiple adversarial agents for outputting interference information can be trained.
  • the interference information output by different adversarial agents can interfere with different types of target tasks.
  • training adversarial agents not only the adversarial agents obtained in the latest iteration are used to output For interference on the target task, the historical training results of historical adversarial agents (adversarial agents obtained during the historical iteration process) can also be used to output interference on the target task, so that the system can be adapted to different scenarios. More effective interference with the target task, thereby improving the training effect and generalization of the model.
  • the first target neural network in the embodiment of this application includes but is not limited to deep neural network, Bayesian neural network, etc.
  • the first target neural network when determining an adversarial agent for outputting interference information as the first reinforcement learning model, may be selected from the plurality of first neural networks, wherein, Each first neural network is an iterative result obtained by iteratively training the first initial neural network.
  • neural network 1 neural network 2, neural network 3, neural network 4, neural network 5, neural network 6, neural network 7, neural network 8, neural network Network 9, when determining the adversarial agent for outputting interference information as the first reinforcement learning model, can be selected from the set [Neural Network 1, Neural Network 2, Neural Network 3, Neural Network 4, Neural Network 5, Neural Network 6 , Neural Network 7, Neural Network 8, Neural Network 9] Select a neural network.
  • selecting the first target neural network from a plurality of first neural networks includes: based on a first selection corresponding to each first neural network in the plurality of first neural networks. probability, selecting the first target neural network from a plurality of first neural networks. That is to say, each first neural network can be configured with a corresponding probability (ie, the first selection probability described above).
  • the first neural network can be selected based on multiple first neural networks. A probability distribution corresponding to a neural network is used to sample and the network is selected based on the sampling results.
  • the processing result obtained by each first neural network processing data is used as interference when executing the target task, and the first selection probability is the same as the processing result output by the corresponding first neural network.
  • the degree of interference with the target task is positively correlated.
  • a reward value can be obtained.
  • the reward value can represent the excellence of the data output by the reinforcement learning model in performing the target task, and can also represent the adversarial intelligence.
  • the probability distribution corresponding to the first neural network can be updated based on the reward value, so that the first selection probability and the corresponding processing result output by the first neural network have a positive impact on the first neural network.
  • the degree of interference from the target task is positively related.
  • the above probability distribution can be a Nash equilibrium distribution.
  • the probability distribution can be calculated through Nash equilibrium based on the reward value obtained when performing the target task based on the data and interference information obtained during the feedforward of the reinforcement learning model. During the iteration process, the probability distribution can be updated.
  • the embodiment of the present application controls the behavior space of the adversarial agent and changes the interference intensity of the adversarial agent, making the reinforcement learning strategy robust to both strong and weak interference.
  • the reinforcement learning strategy is more robust to interference from different strategies.
  • the first data can be processed through a first target neural network to obtain a second processing result, and the second processing result is used as the basis for executing the target. Interfering information during the task.
  • the second processing result may be a force or moment applied to at least one joint on the robot.
  • the second processing result may be a force or moment exerted on the road conditions of the vehicle. Obstacles or other obstacle information that can affect driving strategies.
  • multiple adversarial agents can be trained, and for each adversarial agent in the multiple adversarial agents, multiple adversarial agents can be trained from Choose to interfere with the reinforcement learning model among the iteration results. of adversarial agents.
  • neural network A1, neural network A2, neural network A3, neural network A4, neural network A5, neural network A6, neural network Network A7, neural network A8, and neural network A9 when determining the adversarial agent used to output interference information as the first reinforcement learning model, can be obtained from the set [neural network A1, neural network A2, neural network A3, neural network A4 , neural network A5, neural network A6, neural network A7, neural network A8, neural network A9], which is the first target neural network in the above embodiment.
  • neural network B1, neural network B2, neural network B3, neural network B4, and neural network B5 can be obtained , neural network B6, neural network B7, neural network B8, neural network B9, when determining the adversarial agent used to output interference information as the first reinforcement learning model, it can be obtained from the set [neural network B1, neural network B2, neural network Select a neural network among the network B3, neural network B4, neural network B5, neural network B6, neural network B7, neural network B8, and neural network B9], that is, the second target neural network.
  • the data output by the first target neural network and the second target neural network can be used as interference information applied to the first reinforcement learning model.
  • the first data can be processed through the second target neural network to obtain a fourth processing result; wherein, The second processing result is used as interference when executing the target task, the second target neural network is selected from a plurality of second neural networks, and each of the second neural networks is a pair of second initial neural networks.
  • An iterative result obtained by the iterative training process of the network; the first initial neural network and the second initial neural network are different.
  • the interference types of the second processing result and the fourth processing result are different.
  • the interference type may be a category of interference applied when performing the target task, such as applying force, applying torque, adding obstacles, changing road conditions, changing weather, etc.
  • the interference objects of the second processing result and the fourth processing result are different.
  • the robot may include multiple joints, and applying force to different joints or different joint groups may be considered to be different interference objects. That is, the second processing result and the fourth processing result are forces applied to different joints or different joint groups.
  • the first target neural network is used to determine the second processing result from a first numerical range according to the first data
  • the second target neural network is used to determine the second processing result according to the first numerical range.
  • the first data determines the fourth processing result from a second numerical range
  • the second numerical range is different from the first numerical range.
  • the second processing result and the fourth processing result are both forces exerted on the robot joints.
  • the maximum value of the force determined by the first target neural network is A1
  • the maximum value of the force determined by the second target neural network is The maximum value of is A2, A1 and A2 are different.
  • the first processing result can be used as a hard constraint when executing the target task, that is, the first processing result can be used as the control information that the target object needs to satisfy when executing the target task, and the second processing result can be applied to the target object when executing the target task.
  • the third processing result can be the state of the target object when (or after) it performs the target task, and the third processing result can be used to determine the reward value.
  • the first processing result and the second processing result may be part of the data for determining the third processing result, and may also include other interference information in addition to the second processing result (such as the fourth processing introduced in the above embodiment). result), the target task can be executed based on the first processing result, the second processing result and other processing results to obtain a third processing result.
  • the first reinforcement learning model when updating the model, can be updated according to the third processing result to obtain an updated first reinforcement learning model.
  • the cumulative reward obtained can be maximized.
  • the update method can adopt the reinforcement learning algorithm of the continuous action space.
  • the trust region policy optimization algorithm trust region policy optimization
  • TRPO trust region policy optimization
  • the first target neural network and the second target neural network can perform different adversarial tasks.
  • the ones required for this training can be selected from multiple adversarial tasks (for example, in order). Confrontation mission.
  • the historical strategy of the adversary agent can be sampled from the historical strategy set of the adversary agent according to the Nash equilibrium distribution, and used for the adversarial reinforcement learning strategy.
  • deploy the selected adversarial agent strategy and the current reinforcement learning strategy perform sampling, and obtain the required training samples.
  • the reinforcement learning strategy and the updated strategy of the adversarial agent can be added to the Nash equilibrium matrix, and the Nash equilibrium can be calculated to obtain the reinforcement learning and adversarial agents.
  • Nash equilibrium distribution that is, the above-mentioned first choice probability and the second choice probability introduced later.
  • updating the first reinforcement learning model according to the first processing result and the second processing result includes: obtaining the target according to the first processing result and the second processing result.
  • the reward value corresponding to the task; the first reinforcement learning model is updated according to the reward value; further, the first selection probability corresponding to the first target neural network can be updated according to the reward value.
  • the reinforcement learning model participating in the training process in the current round can also be selected from the historical iteration results of the reinforcement learning model. For example, it can be based on probability sampling. For similarities, refer to the process of sampling the adversarial agent in the above embodiment.
  • the second data can be processed through a second reinforcement learning model to obtain a fifth processing result; wherein the second reinforcement learning model is derived from the updated first reinforcement learning model.
  • each of the reinforcement learning models is an iterative result obtained from the iterative training process of the initial reinforcement learning model; the second data indicates the state of the target object, and the third
  • the fifth processing result is used as control information when performing the target task on the target object; the second data is processed through a third target neural network to obtain a sixth processing result; the third target neural network Belonging to the plurality of first neural networks; the sixth processing result is used as interference information when executing the target task; executing the target task according to the fifth processing result and the sixth processing result, Obtain a seventh processing result; update the third target neural network according to the seventh processing result to obtain an updated third target neural network.
  • the second reinforcement learning model may be selected from the plurality of reinforcement learning models.
  • selecting the second reinforcement learning model from the plurality of reinforcement learning models includes: based on the second selection probability corresponding to each reinforcement learning model in the plurality of reinforcement learning models. , selecting the second reinforcement learning model from a plurality of reinforcement learning models.
  • the second selection probability is positively related to the positive execution effect of the processing result output by the corresponding reinforcement learning model when executing the target task.
  • a reward value can be obtained.
  • the reward value can represent the excellence of the data output by the reinforcement learning model in performing the target task, and can be used to strengthen the reinforcement based on the reward value.
  • the probability distribution corresponding to the learning model is updated so that the second selection probability is positively related to the positive execution effect of the processing result output by the corresponding reinforcement learning model when executing the target task.
  • the historical strategy of the reinforcement learning agent can be sampled and selected from the historical strategy collection of the reinforcement learning agent according to the Nash equilibrium distribution for use in the strategy update of the countermeasure agent.
  • deploy the selected reinforcement learning strategy and the current adversarial agent strategy perform sampling, and obtain the required training samples. Use the obtained training samples to train the adversarial agent strategy.
  • Embodiments of the present application provide a model training method.
  • the method includes: processing first data through a first reinforcement learning model to obtain a first processing result; wherein the first data indicates the state of the target object, and the first data indicates the state of the target object.
  • the first processing result is used as control information when performing a target task on the target object; the first data is processed through the first target neural network to obtain a second processing result; wherein, the second processing The result is used as interference information when executing the target task.
  • the first target neural network is selected from a plurality of first neural networks, and each of the first neural networks iterates the first initial neural network.
  • Figure 5 shows a robot control system.
  • the robot control system may include: state awareness and processing module, robust decision-making module, and robot control module.
  • the function of this module is to sense the information of the robot (such as the information used to describe the state of the target object introduced in the above embodiment, such as the first data, the second data, etc.). Specifically, it combines the information transmitted by each sensor to determine the robot's own status, including the robot's basic information (position, speed), the status of each joint (position, angle, speed, acceleration) and other information, and transfers this information to decision-making module
  • the function of this module is to output upper-level behavioral decisions in the future based on the current robot status and the task being performed (such as when performing the target task on the target object introduced in the above embodiment). control information). Specifically, based on the current state of the robot output by the state sensing and processing module, this module can output behavioral decisions for a period of time in the future through the method corresponding to Figure 4, and pass them to the robot control module.
  • This module controls the movement of the robot by controlling the joints of the robot and executing the behavior output by the robust decision-making module.
  • FIG. 6 is a flowchart of applying the model training method in the embodiment of the present application to a robot control simulation scenario.
  • the robot adopts the model training method in the embodiment of this application through the multi-task framework and gambling theory optimization theory, and finally outputs behavioral decisions that can maximize the forward speed of the robot and obtain more rewards.
  • the implementation method is introduced in detail below.
  • the reinforcement learning strategy ⁇ and the adversarial agent strategy ⁇ i,t control the robot to sample in the training environment to obtain M samples (s state, a pro , a adv , s′, r reward), where a pro , a adv are the behavioral output of the reinforcement learning strategy and the behavior of the adversarial agent respectively.
  • the update method can adopt the reinforcement learning algorithm of the continuous action space, and optionally, the trust region policy optimization algorithm (TRPO) can be adopted.
  • TRPO trust region policy optimization algorithm
  • the update method can adopt the reinforcement learning algorithm of the continuous action space.
  • the trusted region policy optimization algorithm TRPO can be used.
  • the above-described embodiment uses a robust reinforcement learning control framework based on multi-task learning and game theory to construct multiple adversarial tasks by changing the action space of the adversarial agent to improve the robustness of the reinforcement learning algorithm.
  • an optimization framework based on game theory is introduced to select the most appropriate confrontation strategy based on historical strategy performance during the training process of each task, making the reinforcement learning strategy more robust.
  • the game theory optimization framework in the embodiments of this application includes but is not limited to policy-space response oracles (PSRO), etc.; the training of reinforcement learning models includes but is not limited to sampling reinforcement learning algorithms, such as Letter space policy optimization algorithm (TRPO), proximal policy optimization algorithm (proximal policy optimization, PPO), etc.
  • TRPO Letter space policy optimization algorithm
  • proximal policy optimization algorithm proximal policy optimization, PPO
  • the present application provides a model training method, which method includes: processing first data through a first reinforcement learning model to obtain a first processing result; wherein the first data indicates the state of the target object, and the third A processing result is used as control information when performing a target task on the target object; the first data is processed through the first target neural network to obtain a second processing result; wherein the second processing result is represented by As interference information when performing the target task, the first target neural network is selected from a plurality of first neural networks, and each of the first neural networks is iteratively trained on the first initial neural network.
  • an adversarial agent for outputting interference information can be trained.
  • the interference information only performs one kind of interference for the target task.
  • multiple adversarial agents for outputting interference information can be trained.
  • the interference information output by different adversarial agents can interfere with different types of target tasks.
  • the historical training results of historical adversarial agents can also be used to output interference on the target task, so that the system can be adapted to different scenarios. More effective interference with the target task, thereby improving the training effect and generalization of the model.
  • Figure 7 is a schematic structural diagram of a model training device provided by an embodiment of the present application. As shown in Figure 7, the device 700 includes:
  • the data processing module 701 is used to process the first data through the first reinforcement learning model to obtain a first processing result; wherein the first data indicates the state of the target object, and the first processing result is used as the target object. Control information when performing target tasks on the target object;
  • the first data is processed through a first target neural network to obtain a second processing result; wherein the second processing result is used as interference information when executing the target task, and the first target neural network is Selected from a plurality of first neural networks, each first neural network is an iterative result obtained from the process of iterative training of the first initial neural network;
  • step 401 For the specific description of the data processing module 701, reference may be made to the description of step 401, step 402, and step 403 in the above embodiment, which will not be described again here.
  • the model update module 702 is configured to update the first reinforcement learning model according to the third processing result to obtain an updated first reinforcement learning model.
  • model update module 702 For a specific description of the model update module 702, reference may be made to the description of step 404 in the above embodiment, which will not be described again here.
  • an adversarial agent for outputting interference information can be trained.
  • the interference information only performs one kind of interference for the target task.
  • multiple adversarial agents for outputting interference information can be trained.
  • the interference information output by different adversarial agents can interfere with different types of target tasks.
  • training adversarial agents not only the adversarial agents obtained in the latest iteration are used to output For interference on the target task, the historical training results of historical adversarial agents (adversarial agents obtained during the historical iteration process) can also be used to output interference on the target task, so that the system can be adapted to different scenarios. More effective interference with the target task, thereby improving the training effect and generalization of the model.
  • the target object is a robot; the target task is the attitude control of the robot, and the first processing result is the attitude control information of the robot; or,
  • the target object is a vehicle; the target task is automatic driving of the vehicle; and the first processing result is the driving control information of the vehicle.
  • the first target neural network is selected from a plurality of first neural networks based on a first selection probability corresponding to each of the plurality of first neural networks.
  • model update module is specifically used to:
  • the reward value corresponding to the target task is obtained
  • the model update module is also used to:
  • the first selection probability corresponding to the first target neural network is updated.
  • the data processing module is also used to:
  • the first data is processed through a second target neural network to obtain a fourth processing result; wherein the fourth processing result is used as interference information when executing the target task, and the second target neural network is Selected from a plurality of second neural networks, each second neural network is an iterative result obtained from the iterative training process of a second initial neural network; the first initial neural network and the second initial neural network are Neural networks are different;
  • the data processing module is specifically used for:
  • the target task is executed to obtain a third processing result.
  • the interference types of the second processing result and the fourth processing result are different; or,
  • the interference objects of the second processing result and the fourth processing result are different; or,
  • the first target neural network is used to determine the second processing result from a first numerical range according to the first data
  • the second target neural network is used to determine the second processing result from a second numerical value according to the first data.
  • the fourth processing result is determined within a range, and the second numerical range is different from the first numerical range.
  • the data processing module is also used to:
  • each of the reinforcement learning models is an iterative result obtained from the iterative training process of the initial reinforcement learning model;
  • the second data indicates the state of the target object, and the fifth processing result is used as the Control information when performing the target task on the target object;
  • the second data is processed through a third target neural network to obtain a sixth processing result;
  • the third target neural network belongs to the plurality of first neural networks;
  • the sixth processing result is used as the basis for executing the Interfering information during the target task;
  • the model update module is also used to:
  • the third target neural network is updated to obtain an updated third target neural network.
  • the second reinforcement learning model is selected from multiple reinforcement learning models based on the second selection probability corresponding to each reinforcement learning model in the multiple reinforcement learning models.
  • FIG. 8 is a schematic structural diagram of an execution device provided by an embodiment of the present application.
  • the execution device 800 can be embodied as a mobile phone, a tablet, a notebook computer, Smart wearable devices, etc. are not limited here.
  • the execution device 800 includes: a receiver 801, a transmitter 802, a processor 803 and a memory 804 (the number of processors 803 in the execution device 800 can be one or more, one processor is taken as an example in Figure 8) , wherein the processor 803 may include an application processor 8031 and a communication processor 8032.
  • the receiver 801, the transmitter 802, the processor 803, and the memory 804 may be connected through a bus or other means.
  • Memory 804 may include read-only memory and random access memory and provides instructions and data to processor 803 .
  • a portion of memory 804 may also include non-volatile random access memory (NVRAM).
  • Memory 804 stores processor and operating instructions, executable modules or data structures, or subsets thereof, or extended sets thereof, where: The operation instructions may include various operation instructions for implementing various operations.
  • Processor 803 controls execution of operations of the device.
  • various components of the execution device are coupled together through a bus system.
  • the bus system may also include a power bus, a control bus, a status signal bus, etc.
  • various buses are called bus systems in the figure.
  • the methods disclosed in the above embodiments of the present application can be applied to the processor 803 or implemented by the processor 803.
  • the processor 803 may be an integrated circuit chip with signal processing capabilities. During the implementation process, each step of the above method can be completed by instructions in the form of hardware integrated logic circuits or software in the processor 803 .
  • the above-mentioned processor 803 can be a general processor, a digital signal processor (DSP), a microprocessor or a microcontroller, and can further include an application specific integrated circuit (ASIC), a field programmable Gate array (field-programmable gate array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
  • DSP digital signal processor
  • ASIC application specific integrated circuit
  • FPGA field-programmable gate array
  • the processor 803 can implement or execute the disclosed methods, steps and logical block diagrams in the embodiments of this application.
  • a general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.
  • the steps of the method disclosed in conjunction with the embodiments of the present application can be directly implemented by a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor.
  • the software module can be located in random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, registers and other mature storage media in this field.
  • the storage medium is located in the memory 804.
  • the processor 803 reads the information in the memory 804 and completes the steps of the above method in combination with its hardware.
  • the receiver 801 may be used to receive input numeric or character information and generate signal inputs related to performing relevant settings and functional controls of the device.
  • the transmitter 802 can be used to output numeric or character information; the transmitter 802 can also be used to send instructions to the disk group to modify data in the disk group.
  • the processor 803 is configured to execute the steps of the model obtained through the model training method in the corresponding embodiment of FIG. 4 .
  • FIG. 9 is a schematic structural diagram of the server provided by the embodiment of the present application.
  • the server 900 is implemented by one or more servers.
  • the server 900 can be configured or There is a relatively large difference due to different performance, which may include one or more central processing units (CPU) 99 (for example, one or more processors) and memory 932, and one or more storage applications 942 or data 944 storage medium 930 (eg, one or more mass storage devices).
  • the memory 932 and the storage medium 930 may be short-term storage or persistent storage.
  • the program stored in the storage medium 930 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the server.
  • the central processor 99 may be configured to communicate with the storage medium 930 and execute a series of instruction operations in the storage medium 930 on the server 900 .
  • the server 900 may also include one or more power supplies 99, one or more wired or wireless network interfaces 950, one or more input and output interfaces 958; or, one or more operating systems 941, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM and so on.
  • operating systems 941 such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM and so on.
  • the central processor 99 is used to execute the steps of the model training method in the corresponding embodiment of FIG. 4 .
  • An embodiment of the present application also provides a computer program product including computer readable instructions, which when run on a computer causes the computer to perform the steps performed by the foregoing execution device, or causes the computer to perform the steps performed by the foregoing training device. A step of.
  • Embodiments of the present application also provide a computer-readable storage medium.
  • the computer-readable storage medium stores a program for performing signal processing.
  • the program When the program is run on a computer, it causes the computer to perform the steps performed by the aforementioned execution device. , or, causing the computer to perform the steps performed by the aforementioned training device.
  • the execution device, training device or terminal device provided by the embodiment of the present application may specifically be a chip.
  • the chip includes: a processing unit and a communication unit.
  • the processing unit may be, for example, a processor.
  • the communication unit may be, for example, an input/output interface. Pins or circuits, etc.
  • the processing unit can execute the computer execution instructions stored in the storage unit, so that the chip in the execution device executes the model training method described in the above embodiment, or so that the chip in the training device executes the steps related to model training in the above embodiment.
  • the storage unit is a storage unit within the chip, such as a register, cache, etc.
  • the storage unit may also be a storage unit located outside the chip in the wireless access device, such as Read-only memory (ROM) or other types of static storage devices that can store static information and instructions, random access memory (random access memory, RAM), etc.
  • ROM Read-only memory
  • RAM random access memory
  • Figure 10 is a schematic structural diagram of a chip provided by an embodiment of the present application.
  • the chip can be expressed as: Neural network processor NPU 1000, NPU 1000 is mounted on the main CPU (Host CPU) as a co-processor, and the Host CPU allocates tasks.
  • the core part of the NPU is the arithmetic circuit 1003.
  • the arithmetic circuit 1003 is controlled by the controller 1004 to extract the matrix data in the memory and perform multiplication operations.
  • the computing circuit 1003 includes multiple processing units (Process Engine, PE).
  • arithmetic circuit 1003 is a two-dimensional systolic array.
  • the arithmetic circuit 1003 may also be a one-dimensional systolic array or other electronic circuit capable of performing mathematical operations such as multiplication and addition.
  • arithmetic circuit 1003 is a general-purpose matrix processor.
  • the arithmetic circuit obtains the corresponding data of matrix B from the weight memory 1002 and caches it on each PE in the arithmetic circuit.
  • the operation circuit takes matrix A data and matrix B from the input memory 1001 to perform matrix operations, and the partial result or final result of the obtained matrix is stored in an accumulator (accumulator) 1008 .
  • the unified memory 1006 is used to store input data and output data.
  • the weight data directly passes through the storage unit access controller (Direct Memory Access Controller, DMAC) 1005, and the DMAC is transferred to the weight memory 1002.
  • Input data is also transferred to unified memory 1006 via DMAC.
  • DMAC Direct Memory Access Controller
  • BIU is the Bus Interface Unit, that is, the bus interface unit 1010, which is used for the interaction between the AXI bus and the DMAC and the Instruction Fetch Buffer (IFB) 1009.
  • IFB Instruction Fetch Buffer
  • the bus interface unit 1010 (Bus Interface Unit, BIU for short) is used to fetch the memory 1009 to obtain instructions from the external memory, and is also used for the storage unit access controller 1005 to obtain the original data of the input matrix A or the weight matrix B from the external memory.
  • BIU Bus Interface Unit
  • DMAC is mainly used to transfer the input data in the external memory DDR to the unified memory 1006 or the weight data to the weight memory 1002 or the input data to the input memory 1001 .
  • the vector calculation unit 1007 includes multiple arithmetic processing units, and if necessary, further processes the output of the arithmetic circuit, such as vector multiplication, vector addition, exponential operation, logarithmic operation, size comparison, etc.
  • vector calculation unit 1007 can store the processed output vectors to unified memory 1006 .
  • the vector calculation unit 1007 can apply a linear function; or a nonlinear function to the output of the operation circuit 1003, such as linear interpolation on the feature plane extracted by the convolution layer, or a vector of accumulated values, to generate an activation value.
  • vector calculation unit 1007 generates normalized values, pixel-wise summed values, or both.
  • the processed output vector can be used as an activation input to the arithmetic circuit 1003, such as for use in a subsequent layer in a neural network.
  • the instruction fetch buffer 1009 connected to the controller 1004 is used to store instructions used by the controller 1004;
  • the unified memory 1006, the input memory 1001, the weight memory 1002 and the fetch memory 1009 are all On-Chip memories. External memory is private to the NPU hardware architecture.
  • the processor mentioned in any of the above places can be a general central processing unit, a microprocessor, an ASIC, or one or more integrated circuits used to control the execution of the above programs.
  • the device embodiments described above are only illustrative.
  • the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physically separate.
  • the physical unit can be located in one place, or it can be distributed across multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • the connection relationship between modules indicates that there are communication connections between them, which can be specifically implemented as one or more communication buses or signal lines.
  • the present application can be implemented by software plus necessary general hardware. Of course, it can also be implemented by dedicated hardware including dedicated integrated circuits, dedicated CPUs, dedicated memories, Special components, etc. to achieve. In general, all functions performed by computer programs can be easily implemented with corresponding hardware. Moreover, the specific hardware structures used to implement the same function can also be diverse, such as analog circuits, digital circuits or special-purpose circuits. circuit etc. However, for this application, software program implementation is a better implementation in most cases. Based on this understanding, the technical solution of the present application can be embodied in the form of a software product in essence or that contributes to the existing technology.
  • the computer software product is stored in a readable storage medium, such as a computer floppy disk. , U disk, mobile hard disk, ROM, RAM, magnetic disk or optical disk, etc., including several instructions to cause a computer device (which can be a personal computer, training device, or network device, etc.) to execute the steps described in various embodiments of this application. method.
  • a computer device which can be a personal computer, training device, or network device, etc.
  • the computer program product includes one or more computer instructions.
  • the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device.
  • the computer instructions may be stored in or transmitted from one computer-readable storage medium to another, for example, the computer instructions may be transferred from a website, computer, training device, or data
  • the center transmits to another website site, computer, training equipment or data center through wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) means.
  • wired such as coaxial cable, optical fiber, digital subscriber line (DSL)
  • wireless such as infrared, wireless, microwave, etc.
  • the computer-readable storage medium may be any available medium that a computer can store, or a data storage device such as a training device or a data center integrated with one or more available media.
  • the available media may be magnetic media (eg, floppy disk, hard disk, magnetic tape), optical media (eg, DVD), or semiconductor media (eg, solid state disk (Solid State Disk, SSD)), etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • General Health & Medical Sciences (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Computational Linguistics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Evolutionary Computation (AREA)
  • Artificial Intelligence (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Feedback Control In General (AREA)

Abstract

A model training method, relating to the field of artificial intelligence. The method comprises: processing first data by means of a first reinforcement learning model to obtain a first processing result; processing the first data by means of a first target neural network selected from among a plurality of first neural networks to obtain a second processing result, wherein each first neural network is an iteration result obtained by performing iterative training on a first initial neural network; and updating the first reinforcement learning model according to the first processing result and the second processing result. According to the present application, the interference for a target task is output by utilizing a historical training result of a historical adversarial agent (an adversarial agent obtained in a historical iteration process), such that more effective interference for the target task under different scenarios can be obtained, thereby improving the training effect and generalization of a model.

Description

一种模型训练方法及相关设备A model training method and related equipment
本申请要求于2022年6月21日提交中国专利局、申请号为202210705971.0、发明名称为“一种模型训练方法及相关设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims priority to the Chinese patent application filed with the China Patent Office on June 21, 2022, with the application number 202210705971.0 and the invention title "A model training method and related equipment", the entire content of which is incorporated into this application by reference. middle.
技术领域Technical field
本申请涉及人工智能领域,尤其涉及一种模型训练方法及相关设备。This application relates to the field of artificial intelligence, and in particular to a model training method and related equipment.
背景技术Background technique
人工智能(Artificial Intelligence,AI)是通过数字计算机或者数字计算机控制的机器模拟、延伸和扩展人的智能,感知环境、获取知识并使用知识获得最佳结果的理论、方法、技术及应用系统。换句话说,人工智能是计算机科学的一个分支,它企图了解智能的实质,并生产出一种新的能以人类智能相似的方式作出反应的智能机器。人工智能也就是研究各种智能机器的设计原理与实现方法,使机器具有感知、推理与决策的功能。人工智能领域的研究包括机器人,自然语言处理,计算机视觉,决策与推理,人机交互,推荐与搜索,AI基础理论等。Artificial Intelligence (AI) is a theory, method, technology and application system that simulates, extends and expands human intelligence through digital computers or machines controlled by digital computers, perceives the environment, acquires knowledge and uses knowledge to obtain the best results. In other words, artificial intelligence is a branch of computer science that attempts to understand the nature of intelligence and produce a new class of intelligent machines that can respond in a manner similar to human intelligence. Artificial intelligence is the study of the design principles and implementation methods of various intelligent machines, so that the machines have the functions of perception, reasoning and decision-making. Research in the field of artificial intelligence includes robotics, natural language processing, computer vision, decision-making and reasoning, human-computer interaction, recommendation and search, basic AI theory, etc.
强化学习(reinforcement learning,RL)是人工智能领域一种重要的机器学习方法,在自动驾驶、智能控制机器人及分析预测等领域有许多应用。具体的,通过强化学习要解决的主要问题是,智能设备如何直接与环境进行交互来学习执行特定任务时采用的技能,以实现针对特定任务的长期奖励最大。在强化学习算法的应用过程中,经常需要线上环境进行交互来获得数据并进行训练。一般的做法是将现实世界的真实场景进行建模,生成虚拟仿真的线上环境。在这种情况下,如果训练环境和需要部署的真实环境具有微小差异,也很可能会导致训练得到的算法失效,造成在真实场景中的表现不及预期。Reinforcement learning (RL) is an important machine learning method in the field of artificial intelligence. It has many applications in fields such as autonomous driving, intelligent control of robots, and analysis and prediction. Specifically, the main problem to be solved through reinforcement learning is how smart devices directly interact with the environment to learn the skills used to perform specific tasks in order to maximize long-term rewards for specific tasks. In the application process of reinforcement learning algorithms, it is often necessary to interact with the online environment to obtain data and conduct training. The general approach is to model real scenes in the real world and generate an online environment for virtual simulation. In this case, if there is a slight difference between the training environment and the real environment that needs to be deployed, it is likely to cause the trained algorithm to fail, causing the performance in the real scenario to be lower than expected.
上述问题可以通过提升强化学习算法的鲁棒性来进行缓解。一种方法是通过在虚拟环境中引入假想干扰,在具有干扰的情况下训练强化学习算法,提升其应对干扰的能力,增强算法的鲁棒性和泛化性,也就是说,针对于待训练的强化学习模型,可以设置一个对抗智能体,该对抗智能体输出的数据可以和强化学习模型的输出数据共同执行任务,且抗智能体输出的数据可以作为执行目标任务的干扰。然而,由于训练环境和部署环境的差异不可预见,现有训练方法中,对抗智能体只能输出某种特定的干扰(例如针对于机器人控制,可以对某个关节施加特定范围内的作用力作为干扰),当真实环境中的变化与假想干扰(也就是对抗智能体输出的干扰)不一致时,会导致算法效果下降,鲁棒性较差。The above problems can be alleviated by improving the robustness of reinforcement learning algorithms. One method is to introduce imaginary interference in the virtual environment, train the reinforcement learning algorithm under the interference, improve its ability to deal with interference, and enhance the robustness and generalization of the algorithm. In other words, for the target to be trained For the reinforcement learning model, you can set up an adversarial agent. The data output by the adversarial agent can perform tasks together with the output data of the reinforcement learning model, and the data output by the anti-agent can serve as interference in executing the target task. However, due to the unforeseen differences between the training environment and the deployment environment, in existing training methods, the adversarial agent can only output a certain kind of specific interference (for example, for robot control, a specific range of force can be applied to a certain joint as Interference), when the changes in the real environment are inconsistent with the imaginary interference (that is, the interference output by the anti-agent), the algorithm will be less effective and less robust.
发明内容Contents of the invention
本申请提供了一种模型训练方法,可以提高模型的训练效果和泛化性。This application provides a model training method that can improve the training effect and generalization of the model.
第一方面,本申请提供了一种模型训练方法,所述方法包括:通过第一强化学习模型,处理第一数据,以得到第一处理结果;其中,所述第一数据指示目标物体的状态,所述第一处理结果用于作为在所述目标物体上执行目标任务时的控制信息;通过第一目标神经网络,处理所述第一数据,以得到第二处理结果;其中,所述第二处理结果用于作为执行所述目标任务时的干扰信息,所述第一目标神经网络为从多个第一神经网络中选择的,每个所述第一神经网络为对第一初始神经网络进行迭代训练的过程得到的一个迭代结果;根据所述第一处理结果和所述第二处理结果,执行所述目标任务,得到第三处理结果;根据所述第三处理结果,更新所述第一强化学习模型,以得到更新后的第一强化学习模型。In a first aspect, this application provides a model training method. The method includes: processing first data through a first reinforcement learning model to obtain a first processing result; wherein the first data indicates the state of the target object. , the first processing result is used as control information when performing a target task on the target object; the first data is processed through the first target neural network to obtain a second processing result; wherein, the first The second processing result is used as interference information when executing the target task. The first target neural network is selected from a plurality of first neural networks, and each of the first neural networks is a pair of the first initial neural network. An iterative result obtained by performing iterative training; according to the first processing result and the second processing result, the target task is executed to obtain a third processing result; according to the third processing result, the third processing result is updated A reinforcement learning model to obtain the updated first reinforcement learning model.
在一种可能的实现中,第一强化学习模型可以为初始化的模型、或者是模型训练过程中一次迭代的输出。应理解,本申请实施例中的强化学习模型包括但不限于深度神经网络、贝叶斯神经网络等。In a possible implementation, the first reinforcement learning model may be an initialized model or the output of an iteration in the model training process. It should be understood that the reinforcement learning models in the embodiments of this application include but are not limited to deep neural networks, Bayesian neural networks, etc.
在一种可能的实现中,在模型训练的前馈过程中,可以通过第一强化学习模型,处理第一数据,以得到第一处理结果。所述第一处理结果用于作为在所述目标物体上执行目标任务时的控制信息,例如,所述目标任务为机器人的姿态操控,所述第一处理结果为机器人的姿态控制信息;或者,所述目标任务为车辆的自动驾驶,所述第一处理结果为车辆的驾驶控制信息。In a possible implementation, during the feedforward process of model training, the first data can be processed through the first reinforcement learning model to obtain the first processing result. The first processing result is used as control information when performing a target task on the target object. For example, the target task is the attitude control of the robot, and the first processing result is the attitude control information of the robot; or, The target task is automatic driving of the vehicle, and the first processing result is the driving control information of the vehicle.
在现有的实现中,可以训练一个用于输出干扰信息的对抗智能体,该干扰信息只针对于目标任务进行一种干扰,在本申请实施例中,一方面,可以训练多个用于输出干扰信息的对抗智能体,不同对抗智 能体输出的干扰信息可以针对于目标任务进行不同类的干扰,另一方面,在训练对抗智能体时,不仅仅利用当前最新迭代得到的对抗智能体来输出针对于目标任务的干扰,还可以利用历史上对抗智能体的历史训练结果(历史迭代过程中得到的对抗智能体)来输出针对于目标任务的干扰,从而可以得到适配于不同的场景下针对于目标任务的更有效的干扰,从而提高模型的训练效果和泛化性。In the existing implementation, an adversarial agent for outputting interference information can be trained. The interference information only performs one kind of interference for the target task. In the embodiment of the present application, on the one hand, multiple adversarial agents for outputting interference information can be trained. Adversarial agents that interfere with information are different adversarial agents. The interference information output by the agent can perform different types of interference on the target task. On the other hand, when training the adversarial agent, not only the adversarial agent obtained in the latest iteration is used to output interference on the target task, but also Use the historical training results of historical adversarial agents (adversarial agents obtained during the historical iteration process) to output interference for the target task, so that more effective interference for the target task can be obtained that is adapted to different scenarios. Thereby improving the training effect and generalization of the model.
在一种可能的实现中,所述第一数据为机器人相关的状态信息;所述目标任务为机器人的姿态操控,所述第一处理结果为机器人的姿态控制信息。In a possible implementation, the first data is status information related to the robot; the target task is attitude control of the robot, and the first processing result is attitude control information of the robot.
在一种可能的实现中,机器人相关的状态信息可以包括但不限于机器人的位置、速度、自身所处的场景相关的信息(例如障碍物信息),机器人的位置、速度可以包括各个关节的状态(位置、角度、速度、加速度等)等信息。In a possible implementation, the robot-related status information may include but is not limited to the robot's position and speed, and information related to the scene it is in (such as obstacle information). The robot's position and speed may include the status of each joint. (position, angle, speed, acceleration, etc.) and other information.
在一种可能的实现中,第一强化学习模型可以根据输入的数据,得到机器人的姿态控制信息,姿态控制信息可以包括机器人的各个关节的控制信息,基于姿态控制信息可以执行机器人的姿态操控任务。In a possible implementation, the first reinforcement learning model can obtain the attitude control information of the robot based on the input data. The attitude control information can include the control information of each joint of the robot, and the attitude control task of the robot can be performed based on the attitude control information. .
在一种可能的实现中,所述第一数据为车辆相关的状态信息;所述目标任务为车辆的自动驾驶,所述第一处理结果为车辆的驾驶控制信息。In a possible implementation, the first data is vehicle-related status information; the target task is automatic driving of the vehicle, and the first processing result is the driving control information of the vehicle.
在一种可能的实现中,车辆相关的状态信息可以包括但不限于车辆的位置、速度、自身所处的场景相关的信息(例如行驶路面的信息、障碍物信息、行人信息、周围车辆的信息)。In a possible implementation, the vehicle-related status information may include but is not limited to the vehicle's position, speed, and information related to the scene in which it is located (such as driving road information, obstacle information, pedestrian information, and surrounding vehicle information). ).
在一种可能的实现中,第一强化学习模型可以根据输入的数据,得到车辆的驾驶控制信息,驾驶控制信息可以包括车辆的速度、方向、行驶轨迹等信息。In a possible implementation, the first reinforcement learning model can obtain the driving control information of the vehicle based on the input data. The driving control information can include the vehicle's speed, direction, driving trajectory and other information.
在一种可能的实现中,所述方法还包括:从所述多个第一神经网络中选择所述第一目标神经网络。In a possible implementation, the method further includes: selecting the first target neural network from the plurality of first neural networks.
在一种可能的实现中,所述第一目标神经网络为基于所述多个第一神经网络中每个第一神经网络对应的第一选择概率,从多个第一神经网络中选择得到的。也就是说,每个第一神经网络可以对应配置一个概率(即上述描述的第一选择概率),在从多个第一神经网络中选择所述第一目标神经网络时,可以基于多个第一神经网络对应的概率分布来进行采样并基于采样结果进行网络选择。In a possible implementation, the first target neural network is selected from a plurality of first neural networks based on a first selection probability corresponding to each of the plurality of first neural networks. . That is to say, each first neural network can be configured with a corresponding probability (ie, the first selection probability described above). When selecting the first target neural network from multiple first neural networks, the first neural network can be selected based on multiple first neural networks. A probability distribution corresponding to a neural network is used to sample and the network is selected based on the sampling results.
在一种可能的实现中,每个第一神经网络处理数据得到的处理结果用于作为执行所述目标任务时的干扰,且所述第一选择概率与对应的第一神经网络输出的处理结果对所述目标任务的干扰程度正相关。其中,第一选择概率可以为可训练的参数,在进行强化学习模型以及对抗智能体的模型更新时,可以得到奖励值,该奖励值一方面可以表征出该强化学习模型输出的数据在执行目标任务时的优良,还可以表征出对抗智能体输出的干扰信息对于目标任务的干扰程度,可以基于奖励值对第一神经网络对应的概率分布进行更新,以使得所述第一选择概率与对应的第一神经网络输出的处理结果对所述目标任务的干扰程度正相关。通过上述方式,一方面,针对于输出干扰程较大的对抗智能体,其对应的被采样概率较大,使得更容易被采样到,提高了对强化学习模型的干扰程度,另一方面,针对于输出干扰程较小的对抗智能体,虽然其对应的被采样概率较小,但仍有可能被采样到,可以提高对强化学习模型的干扰的丰富程度,提高网络的泛化性。In a possible implementation, the processing result obtained by each first neural network processing data is used as interference when executing the target task, and the first selection probability is the same as the processing result output by the corresponding first neural network. The degree of interference with the target task is positively correlated. Among them, the first selection probability can be a trainable parameter. When updating the reinforcement learning model and the model of the adversarial agent, a reward value can be obtained. On the one hand, the reward value can represent the performance of the data output by the reinforcement learning model in executing the target. The excellence in the task can also represent the degree of interference of the interference information output by the adversarial agent on the target task, and the probability distribution corresponding to the first neural network can be updated based on the reward value, so that the first selection probability is consistent with the corresponding The degree of interference of the processing result output by the first neural network to the target task is positively correlated. Through the above method, on the one hand, for an adversarial agent with a large output interference range, its corresponding sampling probability is larger, making it easier to be sampled, which increases the degree of interference to the reinforcement learning model. On the other hand, for For adversarial agents with small output interference range, although their corresponding sampling probability is small, they may still be sampled, which can increase the richness of interference to the reinforcement learning model and improve the generalization of the network.
在一种可能的实现中,上述概率分布可以为纳什均衡分布。概率分布可以基于在根据强化学习模型前馈时得到的数据和干扰信息执行目标任务得到的奖励值通过纳什均衡计算得到,在迭代的过程中,概率分布可以被更新。In a possible implementation, the above probability distribution can be a Nash equilibrium distribution. The probability distribution can be calculated through Nash equilibrium based on the reward value obtained when performing the target task based on the data and interference information obtained during the feedforward of the reinforcement learning model. During the iteration process, the probability distribution can be updated.
本申请实施例通过控制对抗智能体的行为空间,改变对抗智能体的干扰强度,使得强化学习策略对于强弱干扰均鲁棒。此外,通过引入博弈论优化框架,使用历史策略增加对抗智能体的多样性,使得强化学习策略对于不同策略的干扰更加鲁棒。The embodiment of the present application controls the behavior space of the adversarial agent and changes the interference intensity of the adversarial agent, making the reinforcement learning strategy robust to both strong and weak interference. In addition, by introducing a game theory optimization framework and using historical strategies to increase the diversity of adversarial agents, the reinforcement learning strategy is more robust to interference from different strategies.
在一种可能的实现中,所述根据所述第三处理结果,更新所述第一强化学习模型,包括:In a possible implementation, updating the first reinforcement learning model according to the third processing result includes:
根据所述第三处理结果,得到所述目标任务对应的奖励值;According to the third processing result, the reward value corresponding to the target task is obtained;
根据所述奖励值,更新所述第一强化学习模型;According to the reward value, update the first reinforcement learning model;
所述方法还包括:The method also includes:
根据所述奖励值,更新所述第一目标神经网络对应的第一选择概率。 According to the reward value, the first selection probability corresponding to the first target neural network is updated.
在一种可能的实现中,针对于各个对抗任务采样一个对抗智能体之后,可以将强化学习策略和对抗智能体更新后的策略加入纳什均衡矩阵,并计算纳什均衡,得到强化学习和对抗智能体的纳什均衡分布。具体的,所述根据所述第一处理结果以及所述第二处理结果,更新所述第一强化学习模型,包括:根据所述第一处理结果以及所述第二处理结果,得到所述目标任务对应的奖励值;根据所述奖励值,更新所述第一强化学习模型;进而,可以根据所述奖励值,更新所述第一目标神经网络对应的第一选择概率。In one possible implementation, after sampling an adversarial agent for each adversarial task, the reinforcement learning strategy and the updated strategy of the adversarial agent can be added to the Nash equilibrium matrix, and the Nash equilibrium can be calculated to obtain the reinforcement learning and adversarial agents. Nash equilibrium distribution. Specifically, updating the first reinforcement learning model according to the first processing result and the second processing result includes: obtaining the target according to the first processing result and the second processing result. The reward value corresponding to the task; the first reinforcement learning model is updated according to the reward value; further, the first selection probability corresponding to the first target neural network can be updated according to the reward value.
在一种可能的实现中,为了提高对强化学习模型的干扰的丰富性,可以训练多个对抗智能体,且,针对于多个对抗智能体中的每个对抗体,可以从训练时的多个迭代结果中选择对强化学习模型施加干扰的对抗智能体。In a possible implementation, in order to improve the richness of interference to the reinforcement learning model, multiple adversarial agents can be trained, and for each adversarial agent in the multiple adversarial agents, multiple adversarial agents can be trained from Select the adversarial agent that interferes with the reinforcement learning model from the iteration results.
在一种可能的实现中,所述方法还包括:In a possible implementation, the method further includes:
通过第二目标神经网络,处理所述第一数据,以得到第四处理结果;其中,所述第四处理结果用于作为执行所述目标任务时的干扰信息,所述第二目标神经网络为从多个第二神经网络中选择的,每个所述第二神经网络为对第二初始神经网络进行迭代训练的过程得到的一个迭代结果;所述第一初始神经网络和所述第二初始神经网络不同;The first data is processed through a second target neural network to obtain a fourth processing result; wherein the fourth processing result is used as interference information when executing the target task, and the second target neural network is Selected from a plurality of second neural networks, each second neural network is an iterative result obtained from the iterative training process of a second initial neural network; the first initial neural network and the second initial neural network are Neural networks are different;
所述根据所述第一处理结果和所述第二处理结果,执行所述目标任务,得到第三处理结果,包括:Executing the target task according to the first processing result and the second processing result to obtain a third processing result includes:
根据所述第一处理结果、所述第四处理结果和所述第二处理结果,执行所述目标任务,得到第三处理结果。According to the first processing result, the fourth processing result and the second processing result, the target task is executed to obtain a third processing result.
在一种可能的实现中,所述第二处理结果和所述第四处理结果的干扰类型不同。In a possible implementation, the interference types of the second processing result and the fourth processing result are different.
例如,干扰类型可以为在执行目标任务时施加的干扰的类别,例如,施加力、施加力矩、增加障碍物、改变路况、改变天气等等。For example, the interference type may be a category of interference applied when performing the target task, such as applying force, applying torque, adding obstacles, changing road conditions, changing weather, etc.
在一种可能的实现中,所述第二处理结果和所述第四处理结果的干扰对象不同。In a possible implementation, the interference objects of the second processing result and the fourth processing result are different.
例如,机器人可以包括多个关节,对不同的关节、或者不同的关节组施加力可以认为干扰对象的不同。也就是,第二处理结果和所述第四处理结果是对不同的关节、或者不同的关节组施加的力。For example, the robot may include multiple joints, and applying force to different joints or different joint groups may be considered to be different interference objects. That is, the second processing result and the fourth processing result are forces applied to different joints or different joint groups.
在一种可能的实现中,所述第一目标神经网络用于根据所述第一数据,从第一数值范围内确定所述第二处理结果,所述第二目标神经网络用于根据所述第一数据,从第二数值范围内确定所述第四处理结果,所述第二数值范围和所述第一数值范围不同。In a possible implementation, the first target neural network is used to determine the second processing result from a first numerical range according to the first data, and the second target neural network is used to determine the second processing result according to the first numerical range. The first data determines the fourth processing result from a second numerical range, and the second numerical range is different from the first numerical range.
例如,第二处理结果和第四处理结果都是对机器人关节施加的力,第一目标神经网络所确定出的力的大小的最大值是A1,第二目标神经网络所确定出的力的大小的最大值是A2,A1和A2不同。For example, the second processing result and the fourth processing result are both forces exerted on the robot joints. The maximum value of the force determined by the first target neural network is A1, and the maximum value of the force determined by the second target neural network is The maximum value of is A2, A1 and A2 are different.
在一种可能的实现中,在对对抗智能体进行迭代训练的过程中,也可以从强化学习模型的历史迭代结果中选择当前轮次参与训练过程的强化学习模型。例如可以基于概率采样的方式,相似之处可以参照上述实施例中关于对对抗智能体进行采样的过程。In a possible implementation, during the iterative training process of the adversarial agent, the reinforcement learning model participating in the training process in the current round can also be selected from the historical iteration results of the reinforcement learning model. For example, it can be based on probability sampling. For similarities, refer to the process of sampling the adversarial agent in the above embodiment.
在一种可能的实现中,可以通过第二强化学习模型,处理第二数据,以得到第五处理结果;其中,所述第二强化学习模型为从包括所述更新后的第一强化学习模型在内的多个强化学习模型中选择的,每个所述强化学习模型为对初始强化学习模型进行迭代训练的过程得到的一个迭代结果;所述第二数据指示目标物体的状态,所述第五处理结果用于作为在所述目标物体上执行所述目标任务时的控制信息;通过第三目标神经网络,处理所述第二数据,以得到第六处理结果;所述第三目标神经网络属于所述多个第一神经网络;所述第六处理结果用于作为执行所述目标任务时的干扰信息;根据所述第五处理结果和所述第六处理结果,执行所述目标任务,得到第七处理结果;根据所述第七处理结果,更新所述第三目标神经网络,以得到更新后的第三目标神经网络。In a possible implementation, the second data can be processed through a second reinforcement learning model to obtain a fifth processing result; wherein the second reinforcement learning model is derived from the updated first reinforcement learning model. Selected from a plurality of reinforcement learning models, each of the reinforcement learning models is an iterative result obtained from the iterative training process of the initial reinforcement learning model; the second data indicates the state of the target object, and the third The fifth processing result is used as control information when performing the target task on the target object; the second data is processed through a third target neural network to obtain a sixth processing result; the third target neural network Belonging to the plurality of first neural networks; the sixth processing result is used as interference information when executing the target task; executing the target task according to the fifth processing result and the sixth processing result, Obtain a seventh processing result; update the third target neural network according to the seventh processing result to obtain an updated third target neural network.
在一种可能的实现中,可以从所述多个强化学习模型中选择所述第二强化学习模型。In a possible implementation, the second reinforcement learning model may be selected from the plurality of reinforcement learning models.
在一种可能的实现中,所述从所述多个强化学习模型中选择所述第二强化学习模型,包括:基于所述多个强化学习模型中每个强化学习模型对应的第二选择概率,从多个强化学习模型中选择所述第二强化学习模型。 In a possible implementation, selecting the second reinforcement learning model from the plurality of reinforcement learning models includes: based on the second selection probability corresponding to each reinforcement learning model in the plurality of reinforcement learning models. , selecting the second reinforcement learning model from a plurality of reinforcement learning models.
在一种可能的实现中,所述第二选择概率与对应的强化学习模型输出的处理结果在执行目标任务时正向的执行效果正相关。其中,在进行强化学习模型以及对抗智能体的模型更新时,可以得到奖励值,该奖励值一方面可以表征出该强化学习模型输出的数据在执行目标任务时的优良,可以基于奖励值对强化学习模型对应的概率分布进行更新,以使得所述第二选择概率与对应的强化学习模型输出的处理结果在执行目标任务时的正向的执行效果正相关。In a possible implementation, the second selection probability is positively related to the positive execution effect of the processing result output by the corresponding reinforcement learning model when executing the target task. Among them, when updating the reinforcement learning model and the model of the adversarial agent, a reward value can be obtained. On the one hand, the reward value can represent the excellence of the data output by the reinforcement learning model in performing the target task, and can be used to strengthen the reinforcement based on the reward value. The probability distribution corresponding to the learning model is updated so that the second selection probability is positively related to the positive execution effect of the processing result output by the corresponding reinforcement learning model when executing the target task.
在一种可能的实现中,可以从强化学习智能体的历史策略集合中,根据纳什均衡分布,抽样选择强化学习智能体的历史策略,用于对抗智能体策略更新。在训练环境中,部署选择的强化学习策略和当前的对抗智能体策略,进行采样,得到所需的训练样本。使用的得到的训练样本训练对抗智能体策略。In a possible implementation, the historical strategy of the reinforcement learning agent can be sampled and selected from the historical strategy collection of the reinforcement learning agent according to the Nash equilibrium distribution for use in the strategy update of the countermeasure agent. In the training environment, deploy the selected reinforcement learning strategy and the current adversarial agent strategy, perform sampling, and obtain the required training samples. Use the obtained training samples to train the adversarial agent strategy.
第二方面,本申请提供了一种模型训练装置,所述装置包括:In a second aspect, this application provides a model training device, which includes:
数据处理模块,用于通过第一强化学习模型,处理第一数据,以得到第一处理结果;其中,所述第一数据指示目标物体的状态,所述第一处理结果用于作为在所述目标物体上执行目标任务时的控制信息;The data processing module is used to process the first data through the first reinforcement learning model to obtain the first processing result; wherein the first data indicates the state of the target object, and the first processing result is used as the first processing result in the Control information when performing target tasks on the target object;
通过第一目标神经网络,处理所述第一数据,以得到第二处理结果;其中,所述第二处理结果用于作为执行所述目标任务时的干扰信息,所述第一目标神经网络为从多个第一神经网络中选择的,每个所述第一神经网络为对第一初始神经网络进行迭代训练的过程得到的一个迭代结果;The first data is processed through a first target neural network to obtain a second processing result; wherein the second processing result is used as interference information when executing the target task, and the first target neural network is Selected from a plurality of first neural networks, each first neural network is an iterative result obtained from the process of iterative training of the first initial neural network;
根据所述第一处理结果和所述第二处理结果,执行所述目标任务,得到第三处理结果;According to the first processing result and the second processing result, execute the target task and obtain a third processing result;
模型更新模块,用于根据所述第三处理结果,更新所述第一强化学习模型,以得到更新后的第一强化学习模型。A model update module, configured to update the first reinforcement learning model according to the third processing result to obtain an updated first reinforcement learning model.
在现有的实现中,可以训练一个用于输出干扰信息的对抗智能体,该干扰信息只针对于目标任务进行一种干扰,在本申请实施例中,一方面,可以训练多个用于输出干扰信息的对抗智能体,不同对抗智能体输出的干扰信息可以针对于目标任务进行不同类的干扰,另一方面,在训练对抗智能体时,不仅仅利用当前最新迭代得到的对抗智能体来输出针对于目标任务的干扰,还可以利用历史上对抗智能体的历史训练结果(历史迭代过程中得到的对抗智能体)来输出针对于目标任务的干扰,从而可以得到适配于不同的场景下针对于目标任务的更有效的干扰,从而提高模型的训练效果和泛化性。In the existing implementation, an adversarial agent for outputting interference information can be trained. The interference information only performs one kind of interference for the target task. In the embodiment of the present application, on the one hand, multiple adversarial agents for outputting interference information can be trained. Adversarial agents that interfere with information. The interference information output by different adversarial agents can interfere with different types of target tasks. On the other hand, when training adversarial agents, not only the adversarial agents obtained in the latest iteration are used to output For interference on the target task, the historical training results of historical adversarial agents (adversarial agents obtained during the historical iteration process) can also be used to output interference on the target task, so that the system can be adapted to different scenarios. More effective interference with the target task, thereby improving the training effect and generalization of the model.
在一种可能的实现中,In one possible implementation,
所述目标物体为机器人;所述目标任务为机器人的姿态操控,所述第一处理结果为机器人的姿态控制信息;或者,The target object is a robot; the target task is the attitude control of the robot, and the first processing result is the attitude control information of the robot; or,
所述目标物体为车辆;所述目标任务为车辆的自动驾驶,所述第一处理结果为车辆的驾驶控制信息。The target object is a vehicle; the target task is automatic driving of the vehicle; and the first processing result is the driving control information of the vehicle.
在一种可能的实现中,所述装置还包括:In a possible implementation, the device further includes:
网络选择模块,用于从所述多个第一神经网络中选择所述第一目标神经网络。A network selection module, configured to select the first target neural network from the plurality of first neural networks.
在一种可能的实现中,所述第一目标神经网络为基于所述多个第一神经网络中每个第一神经网络对应的第一选择概率,从多个第一神经网络中选择得到的。In a possible implementation, the first target neural network is selected from a plurality of first neural networks based on a first selection probability corresponding to each of the plurality of first neural networks. .
在一种可能的实现中,每个第一神经网络处理数据得到的处理结果用于作为执行所述目标任务时的干扰,且所述第一选择概率与对应的第一神经网络输出的处理结果对所述目标任务的干扰程度正相关。In a possible implementation, the processing result obtained by each first neural network processing data is used as interference when executing the target task, and the first selection probability is the same as the processing result output by the corresponding first neural network. The degree of interference with the target task is positively correlated.
在一种可能的实现中,所述模型更新模块,具体用于:In a possible implementation, the model update module is specifically used to:
根据所述第三处理结果,得到所述目标任务对应的奖励值;According to the third processing result, the reward value corresponding to the target task is obtained;
根据所述奖励值,更新所述第一强化学习模型;According to the reward value, update the first reinforcement learning model;
所述模型更新模块,还用于:The model update module is also used to:
根据所述奖励值,更新所述第一目标神经网络对应的第一选择概率。 According to the reward value, the first selection probability corresponding to the first target neural network is updated.
在一种可能的实现中,所述数据处理模块,还用于:In a possible implementation, the data processing module is also used to:
通过第二目标神经网络,处理所述第一数据,以得到第四处理结果;其中,所述第四处理结果用于作为执行所述目标任务时的干扰信息,所述第二目标神经网络为从多个第二神经网络中选择的,每个所述第二神经网络为对第二初始神经网络进行迭代训练的过程得到的一个迭代结果;所述第一初始神经网络和所述第二初始神经网络不同;The first data is processed through a second target neural network to obtain a fourth processing result; wherein the fourth processing result is used as interference information when executing the target task, and the second target neural network is Selected from a plurality of second neural networks, each second neural network is an iterative result obtained from the iterative training process of a second initial neural network; the first initial neural network and the second initial neural network are Neural networks are different;
所述数据处理模块,具体用于:The data processing module is specifically used for:
根据所述第一处理结果、所述第四处理结果和所述第二处理结果,执行所述目标任务,得到第三处理结果。According to the first processing result, the fourth processing result and the second processing result, the target task is executed to obtain a third processing result.
在一种可能的实现中,In one possible implementation,
所述第二处理结果和所述第四处理结果的干扰类型不同;或者,The interference types of the second processing result and the fourth processing result are different; or,
所述第二处理结果和所述第四处理结果的干扰对象不同;或者,The interference objects of the second processing result and the fourth processing result are different; or,
所述第一目标神经网络用于根据所述第一数据,从第一数值范围内确定所述第二处理结果,所述第二目标神经网络用于根据所述第一数据,从第二数值范围内确定所述第四处理结果,所述第二数值范围和所述第一数值范围不同。The first target neural network is used to determine the second processing result from a first numerical range according to the first data, and the second target neural network is used to determine the second processing result from a second numerical value according to the first data. The fourth processing result is determined within a range, and the second numerical range is different from the first numerical range.
在一种可能的实现中,所述数据处理模块,还用于:In a possible implementation, the data processing module is also used to:
通过第二强化学习模型,处理第二数据,以得到第五处理结果;其中,所述第二强化学习模型为从包括所述更新后的第一强化学习模型在内的多个强化学习模型中选择的,每个所述强化学习模型为对初始强化学习模型进行迭代训练的过程得到的一个迭代结果;所述第二数据指示目标物体的状态,所述第五处理结果用于作为在所述目标物体上执行所述目标任务时的控制信息;Process the second data through the second reinforcement learning model to obtain a fifth processing result; wherein the second reinforcement learning model is selected from a plurality of reinforcement learning models including the updated first reinforcement learning model. Optionally, each of the reinforcement learning models is an iterative result obtained from the iterative training process of the initial reinforcement learning model; the second data indicates the state of the target object, and the fifth processing result is used as the Control information when performing the target task on the target object;
通过第三目标神经网络,处理所述第二数据,以得到第六处理结果;所述第三目标神经网络属于所述多个第一神经网络;所述第六处理结果用于作为执行所述目标任务时的干扰信息;The second data is processed through a third target neural network to obtain a sixth processing result; the third target neural network belongs to the plurality of first neural networks; the sixth processing result is used as the basis for executing the Interfering information during the target task;
根据所述第五处理结果和所述第六处理结果,执行所述目标任务,得到第七处理结果;According to the fifth processing result and the sixth processing result, execute the target task and obtain a seventh processing result;
所述模型更新模块,还用于:The model update module is also used to:
根据所述第七处理结果,更新所述第三目标神经网络,以得到更新后的第三目标神经网络。According to the seventh processing result, the third target neural network is updated to obtain an updated third target neural network.
在一种可能的实现中,所述网络选择模块,还用于:In a possible implementation, the network selection module is also used to:
从所述多个强化学习模型中选择所述第二强化学习模型。The second reinforcement learning model is selected from the plurality of reinforcement learning models.
在一种可能的实现中,所述网络选择模块,具体用于:In a possible implementation, the network selection module is specifically used to:
基于所述多个强化学习模型中每个强化学习模型对应的第二选择概率,从多个强化学习模型中选择所述第二强化学习模型。Select the second reinforcement learning model from the plurality of reinforcement learning models based on the second selection probability corresponding to each reinforcement learning model in the plurality of reinforcement learning models.
第三方面,本申请提供了一种数据处理方法,包括:In the third aspect, this application provides a data processing method, including:
获取第一数据,所述第一数据指示目标物体的状态;Obtaining first data, the first data indicating the status of the target object;
通过第一强化学习模型,处理所述第一数据,以得到第一处理结果;所述第一处理结果用于作为所述目标物体的控制信息;其中,The first data is processed through the first reinforcement learning model to obtain a first processing result; the first processing result is used as the control information of the target object; wherein,
所述第一强化学习模型在训练的一次迭代过程中通过奖励值进行更新,所述奖励值为根据所述第一强化学习模型前馈过程输出的控制信息执行所述目标任务时施加的干扰信息得到,所述干扰信息通过目标神经网络的前馈过程得到,所述目标神经网络为从多个神经网络中选择的,每个所述神经网络为对初始神经网络进行迭代训练的过程得到的一个迭代结果;The first reinforcement learning model is updated by a reward value during an iteration of training, and the reward value is interference information applied when executing the target task according to the control information output by the feedforward process of the first reinforcement learning model. Obtained, the interference information is obtained through the feedforward process of the target neural network, the target neural network is selected from multiple neural networks, and each of the neural networks is one obtained by iteratively training the initial neural network. Iteration results;
根据所述第一处理结果,在所述目标物体上执行目标任务。According to the first processing result, a target task is performed on the target object.
在一种可能的实现中, In one possible implementation,
所述目标物体为机器人;所述目标任务为机器人的姿态操控,所述第一处理结果为机器人的姿态控制信息;或者,The target object is a robot; the target task is the attitude control of the robot, and the first processing result is the attitude control information of the robot; or,
所述目标物体为车辆;所述目标任务为车辆的自动驾驶,所述第一处理结果为车辆的驾驶控制信息。The target object is a vehicle; the target task is automatic driving of the vehicle; and the first processing result is the driving control information of the vehicle.
在一种可能的实现中,所述第标神经网络为基于所述多个神经网络中每个神经网络对应的第一选择概率,从多个第一神经网络中选择得到的。In a possible implementation, the first neural network is selected from a plurality of first neural networks based on a first selection probability corresponding to each neural network in the plurality of neural networks.
在一种可能的实现中,每个神经网络处理数据得到的处理结果用于作为执行所述目标任务时的干扰,且所述第一选择概率与对应的神经网络输出的处理结果对所述目标任务的干扰程度正相关。In a possible implementation, the processing results obtained by each neural network processing data are used as interference when executing the target task, and the first selection probability and the processing results output by the corresponding neural network have a positive impact on the target. The degree of interference of the task is positively related.
第四方面,本申请实施例提供了一种模型训练装置,可以包括存储器、处理器以及总线系统,其中,存储器用于存储程序,处理器用于执行存储器中的程序,以执行如上述第一方面及其任一可选的方法。In the fourth aspect, embodiments of the present application provide a model training device, which may include a memory, a processor, and a bus system. The memory is used to store programs, and the processor is used to execute programs in the memory to perform the first aspect as described above. and any optional methods.
第五方面,本申请实施例提供了一种数据处理装置,可以包括存储器、处理器以及总线系统,其中,存储器用于存储程序,处理器用于执行存储器中的程序,以执行如上述第三方面及其任一可选的方法。In the fifth aspect, embodiments of the present application provide a data processing device, which may include a memory, a processor, and a bus system, wherein the memory is used to store programs, and the processor is used to execute the programs in the memory to perform the third aspect as described above. and any optional methods.
第六方面,本申请实施例提供了一种计算机可读存储介质,计算机可读存储介质中存储有计算机程序,当其在计算机上运行时,使得计算机执行上述第一方面及其任一可选的方法、或者上述第三方面及其任一可选的方法。In a sixth aspect, embodiments of the present application provide a computer-readable storage medium. A computer program is stored in the computer-readable storage medium. When it is run on a computer, it causes the computer to execute the above-mentioned first aspect and any of its options. method, or the above third aspect and any optional method thereof.
第七方面,本申请实施例提供了一种包括指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述第一方面及其任一可选的方法、或者上述第三方面及其任一可选的方法。In a seventh aspect, embodiments of the present application provide a computer program product including instructions that, when run on a computer, cause the computer to execute the above-mentioned first aspect and any of its optional methods, or the above-mentioned third aspect and any of its optional methods. Any optional method.
第八方面,本申请提供了一种芯片系统,该芯片系统包括处理器,用于支持模型训练装置实现上述方面中所涉及的部分或全部功能,例如,发送或处理上述方法中所涉及的数据;或,信息。在一种可能的设计中,芯片系统还包括存储器,存储器,用于保存执行设备或训练设备必要的程序指令和数据。该芯片系统,可以由芯片构成,也可以包括芯片和其他分立器件。In an eighth aspect, this application provides a chip system that includes a processor to support the model training device to implement some or all of the functions involved in the above aspects, for example, sending or processing data involved in the above methods. ; or, information. In a possible design, the chip system also includes a memory, which is used to save necessary program instructions and data for executing the device or training the device. The chip system may be composed of chips, or may include chips and other discrete devices.
本申请实施例提供了一种模型训练方法,所述方法包括:通过第一强化学习模型,处理第一数据,以得到第一处理结果;其中,所述第一数据指示目标物体的状态,所述第一处理结果用于作为在所述目标物体上执行目标任务时的控制信息;通过第一目标神经网络,处理所述第一数据,以得到第二处理结果;其中,所述第二处理结果用于作为执行所述目标任务时的干扰信息,所述第一目标神经网络为从多个第一神经网络中选择的,每个所述第一神经网络为对第一初始神经网络进行迭代训练的过程得到的一个迭代结果;根据所述第一处理结果和所述第二处理结果,执行所述目标任务,得到第三处理结果;根据所述第三处理结果,更新所述第一强化学习模型,以得到更新后的第一强化学习模型。通过上述方式,在训练对抗智能体时,不仅仅利用当前最新迭代得到的对抗智能体来输出针对于目标任务的干扰,还可以利用历史上对抗智能体的历史训练结果(历史迭代过程中得到的对抗智能体)来输出针对于目标任务的干扰,从而可以得到适配于不同的场景下针对于目标任务的更有效的干扰,从而提高模型的训练效果和泛化性。Embodiments of the present application provide a model training method. The method includes: processing first data through a first reinforcement learning model to obtain a first processing result; wherein the first data indicates the state of the target object, and the first data indicates the state of the target object. The first processing result is used as control information when performing a target task on the target object; the first data is processed through the first target neural network to obtain a second processing result; wherein, the second processing The result is used as interference information when executing the target task. The first target neural network is selected from a plurality of first neural networks, and each of the first neural networks iterates the first initial neural network. An iterative result obtained in the training process; according to the first processing result and the second processing result, the target task is executed to obtain a third processing result; according to the third processing result, the first reinforcement is updated Learning model to obtain the updated first reinforcement learning model. Through the above method, when training adversarial agents, not only the adversarial agents obtained in the latest iteration are used to output interference for the target task, but also the historical training results of adversarial agents in history (obtained during the historical iteration process) are used. Adversarial agent) to output interference for the target task, so that more effective interference for the target task can be obtained that is adapted to different scenarios, thereby improving the training effect and generalization of the model.
附图说明Description of the drawings
图1为一种应用架构示意;Figure 1 is a schematic diagram of an application architecture;
图2为一种应用架构示意;Figure 2 is a schematic diagram of an application architecture;
图3为一种应用架构示意;Figure 3 is a schematic diagram of an application architecture;
图4为本申请实施例提供的一种模型训练方法的实施例示意;Figure 4 is a schematic diagram of an embodiment of a model training method provided by an embodiment of the present application;
图5为本申请实施例提供的一种软件架构示意;Figure 5 is a schematic diagram of a software architecture provided by an embodiment of the present application;
图6为本申请实施例提供的一种模型训练方法的实施例示意;Figure 6 is a schematic diagram of an embodiment of a model training method provided by an embodiment of the present application;
图7为本申请实施例提供的一种模型训练装置的实施例示意;Figure 7 is a schematic diagram of an embodiment of a model training device provided by an embodiment of the present application;
图8为本申请实施例提供的执行设备的一种结构示意图;Figure 8 is a schematic structural diagram of an execution device provided by an embodiment of the present application;
图9是本申请实施例提供的服务器一种结构示意图; Figure 9 is a schematic structural diagram of a server provided by an embodiment of the present application;
图10为本申请实施例提供的芯片的一种结构示意图。Figure 10 is a schematic structural diagram of a chip provided by an embodiment of the present application.
具体实施方式Detailed ways
下面结合本发明实施例中的附图对本发明实施例进行描述。本发明的实施方式部分使用的术语仅用于对本发明的具体实施例进行解释,而非旨在限定本发明。The embodiments of the present invention will be described below with reference to the drawings in the embodiments of the present invention. The terms used in the embodiments of the present invention are only used to explain specific embodiments of the present invention and are not intended to limit the present invention.
下面结合附图,对本申请的实施例进行描述。本领域普通技术人员可知,随着技术的发展和新场景的出现,本申请实施例提供的技术方案对于类似的技术问题,同样适用。The embodiments of the present application are described below with reference to the accompanying drawings. Persons of ordinary skill in the art know that with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of this application are also applicable to similar technical problems.
本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的术语在适当情况下可以互换,这仅仅是描述本申请的实施例中对相同属性的对象在描述时所采用的区分方式。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,以便包含一系列单元的过程、方法、系统、产品或设备不必限于那些单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它单元。The terms "first", "second", etc. in the description and claims of this application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the terms so used are interchangeable under appropriate circumstances, and are merely a way of distinguishing objects with the same attributes in describing the embodiments of the present application. Furthermore, the terms "include" and "having" and any variations thereof, are intended to cover non-exclusive inclusions, such that a process, method, system, product or apparatus comprising a series of elements need not be limited to those elements, but may include not explicitly other elements specifically listed or inherent to such processes, methods, products or equipment.
本文中所用用语“基本(substantially)”、“大约(about)”及类似用语用作近似用语、而并非用作程度用语,且旨在考虑到所属领域中的普通技术人员将知的测量值或计算值的固有偏差。此外,在阐述本发明实施例时使用“可(may)”是指“可能的一个或多个实施例”。本文中所用用语“使用(use)”、“正使用(using)”、及“被使用(used)”可被视为分别与用语“利用(utilize)”、“正利用(utilizing)”、及“被利用(utilized)”同义。另外,用语“示例性(exemplary)”旨在指代实例或例示。As used herein, the terms "substantially", "about" and similar terms are used as terms of approximation, not as terms of degree, and are intended to take into account measurements or values that would be known to one of ordinary skill in the art. The inherent bias in calculated values. In addition, the use of "may" when describing embodiments of the present invention refers to "one or more possible embodiments." As used herein, the terms "use", "using", and "used" may be deemed to be the same as the terms "utilize", "utilizing", and "utilize", respectively. Synonymous with "utilized". Additionally, the term "exemplary" is intended to refer to an example or illustration.
首先对人工智能系统总体工作流程进行描述,请参见图1,图1示出的为人工智能主体框架的一种结构示意图,下面从“智能信息链”(水平轴)和“IT价值链”(垂直轴)两个维度对上述人工智能主题框架进行阐述。其中,“智能信息链”反映从数据的获取到处理的一列过程。举例来说,可以是智能信息感知、智能信息表示与形成、智能推理、智能决策、智能执行与输出的一般过程。在这个过程中,数据经历了“数据—信息—知识—智慧”的凝练过程。“IT价值链”从人智能的底层基础设施、信息(提供和处理技术实现)到系统的产业生态过程,反映人工智能为信息技术产业带来的价值。First, the overall workflow of the artificial intelligence system is described. Please refer to Figure 1. Figure 1 shows a structural schematic diagram of the artificial intelligence main framework. The following is from the "intelligent information chain" (horizontal axis) and "IT value chain" ( The above artificial intelligence theme framework is elaborated on the two dimensions of vertical axis). Among them, the "intelligent information chain" reflects a series of processes from data acquisition to processing. For example, it can be the general process of intelligent information perception, intelligent information representation and formation, intelligent reasoning, intelligent decision-making, intelligent execution and output. In this process, the data has gone through the condensation process of "data-information-knowledge-wisdom". The "IT value chain" reflects the value that artificial intelligence brings to the information technology industry, from the underlying infrastructure of human intelligence and information (providing and processing technology implementation) to the systematic industrial ecological process.
(1)基础设施(1)Infrastructure
基础设施为人工智能系统提供计算能力支持,实现与外部世界的沟通,并通过基础平台实现支撑。通过传感器与外部沟通;计算能力由智能芯片(CPU、NPU、GPU、ASIC、FPGA等硬件加速芯片)提供;基础平台包括分布式计算框架及网络等相关的平台保障和支持,可以包括云存储和计算、互联互通网络等。举例来说,传感器和外部沟通获取数据,这些数据提供给基础平台提供的分布式计算系统中的智能芯片进行计算。Infrastructure provides computing power support for artificial intelligence systems, enables communication with the external world, and supports it through basic platforms. Communicate with the outside through sensors; computing power is provided by smart chips (hardware acceleration chips such as CPU, NPU, GPU, ASIC, FPGA, etc.); the basic platform includes distributed computing framework and network and other related platform guarantees and support, which can include cloud storage and Computing, interconnection networks, etc. For example, sensors communicate with the outside world to obtain data, which are provided to smart chips in the distributed computing system provided by the basic platform for calculation.
(2)数据(2)Data
基础设施的上一层的数据用于表示人工智能领域的数据来源。数据涉及到图形、图像、语音、文本,还涉及到传统设备的物联网数据,包括已有系统的业务数据以及力、位移、液位、温度、湿度等感知数据。Data from the upper layer of the infrastructure is used to represent data sources in the field of artificial intelligence. The data involves graphics, images, voice, and text, as well as IoT data of traditional devices, including business data of existing systems and sensory data such as force, displacement, liquid level, temperature, and humidity.
(3)数据处理(3)Data processing
数据处理通常包括数据训练,机器学习,深度学习,搜索,推理,决策等方式。Data processing usually includes data training, machine learning, deep learning, search, reasoning, decision-making and other methods.
其中,机器学习和深度学习可以对数据进行符号化和形式化的智能信息建模、抽取、预处理、训练等。Among them, machine learning and deep learning can perform symbolic and formal intelligent information modeling, extraction, preprocessing, training, etc. on data.
推理是指在计算机或智能系统中,模拟人类的智能推理方式,依据推理控制策略,利用形式化的信息进行机器思维和求解问题的过程,典型的功能是搜索与匹配。Reasoning refers to the process of simulating human intelligent reasoning in computers or intelligent systems, using formal information to perform machine thinking and problem solving based on reasoning control strategies. Typical functions are search and matching.
决策是指智能信息经过推理后进行决策的过程,通常提供分类、排序、预测等功能。Decision-making refers to the process of decision-making after intelligent information is reasoned, and usually provides functions such as classification, sorting, and prediction.
(4)通用能力(4) General ability
对数据经过上面提到的数据处理后,进一步基于数据处理的结果可以形成一些通用的能力,比如可以是算法或者一个通用系统,例如,翻译,文本的分析,计算机视觉的处理,语音识别,图像的识别等等。After the data is processed as mentioned above, some general capabilities can be formed based on the results of further data processing, such as algorithms or a general system, such as translation, text analysis, computer vision processing, speech recognition, and image processing. identification, etc.
(5)智能产品及行业应用 (5) Intelligent products and industry applications
智能产品及行业应用指人工智能系统在各领域的产品和应用,是对人工智能整体解决方案的封装,将智能信息决策产品化、实现落地应用,其应用领域主要包括:智能终端、智能交通、智能医疗、自动驾驶、智慧城市等。Intelligent products and industry applications refer to the products and applications of artificial intelligence systems in various fields. They are the encapsulation of overall artificial intelligence solutions, productizing intelligent information decision-making and realizing practical applications. Its application fields mainly include: intelligent terminals, intelligent transportation, Smart healthcare, autonomous driving, smart cities, etc.
随着人工智能的发展,很多需要人完成的任务逐渐被智能终端代替,则智能终端上需要配置完成任务所使用的技能,以及,针对任务的神经网络,从而实现通过智能终端完成特定任务的功能。具体的,可以为应用于可移动的智能终端中,作为示例,例如在自动驾驶领域,本来由人完成的驾驶操作可以由智能汽车代替执行,则智能汽车中需要配置有大量的驾驶技能以及针对驾驶技能的神经网络;作为另一示例,例如在货运领域,本来由人完成的搬运操作可以由搬运机器人代替执行,则搬运机器人中需要配置有大量的搬运技能以及针对搬运技能的神经网络。也可以为应用于不具有移动操作的智能终端中,作为示例,例如在配件加工的流水线上,本来由人完成的零配件抓取操作可以由智能机械手臂完成,则智能机械手臂中需要配置有抓取技能以及针对抓取技能的神经网络,其中,不同的抓取技能抓取角度、智能机械手臂的位移等可以不同;作为另一示例,例如在自动炒菜领域,本来由人完成的炒菜操作可以由智能机械手臂完成,则智能机械手臂中需要配置有原材料抓取技能、翻炒技能等炒菜技能以及针对炒菜技能的神经网络等等,此处不对其他应用场景进行穷举。With the development of artificial intelligence, many tasks that require humans to complete are gradually replaced by smart terminals. The skills used to complete the tasks need to be configured on the smart terminal, as well as the neural network for the task, so as to realize the function of completing specific tasks through the smart terminal. . Specifically, it can be applied to mobile smart terminals. As an example, in the field of autonomous driving, driving operations originally performed by humans can be performed by smart cars instead. The smart cars need to be equipped with a large number of driving skills and for Neural networks for driving skills; as another example, in the field of freight transportation, the handling operations originally performed by humans can be performed by handling robots, and the handling robots need to be equipped with a large number of handling skills and neural networks for handling skills. It can also be applied to smart terminals without mobile operations. As an example, for example, on a parts processing assembly line, the parts grabbing operation originally completed by humans can be completed by an intelligent robotic arm. In this case, the intelligent robotic arm needs to be equipped with Grasping skills and neural networks for grasping skills, in which different grasping skills can have different grabbing angles, displacements of intelligent robotic arms, etc.; as another example, for example, in the field of automatic cooking, the cooking operation is originally completed by humans. It can be completed by an intelligent robotic arm. The intelligent robotic arm needs to be equipped with cooking skills such as raw material grabbing skills, stir-frying skills, and neural networks for cooking skills. Other application scenarios are not exhaustive here.
为了更好地理解本申请实施例的方案,下面先结合图2和图3对本申请实施例可能的实现架构进行简单的介绍。In order to better understand the solution of the embodiment of the present application, the possible implementation architecture of the embodiment of the present application will be briefly introduced below with reference to Figure 2 and Figure 3 .
图2为本申请实施例中执行模型训练的计算系统的示意。计算系统包括通过网络通信地耦合的终端设备102(示例性的,也可以不包括终端设备102)和服务器130(也可以称之为中心节点)。其中,终端设备102可以是任何类型的计算设备,诸如,例如个人计算设备(例如,膝上型计算机或台式计算机)、移动计算设备(例如,智能电话或平板计算机)、游戏控制台或控制器、可穿戴计算设备、嵌入式计算设备或任何其他类型的计算设备。Figure 2 is a schematic diagram of a computing system that performs model training in an embodiment of the present application. The computing system includes a terminal device 102 (exemplarily, the terminal device 102 may not be included) and a server 130 (which may also be called a central node) communicatively coupled through a network. Wherein, the terminal device 102 may be any type of computing device, such as, for example, a personal computing device (eg, a laptop or desktop computer), a mobile computing device (eg, a smartphone or tablet), a game console or controller , wearable computing devices, embedded computing devices, or any other type of computing device.
终端设备102可以包括处理器112和存储器114。处理器112可以是任何合适的处理设备(例如,处理器核、微处理器、特殊应用集成电路(application specific integrated circuit,ASIC)、现场可编程门阵列(field programmable gate array,FPGA)、控制器、微控制器等)。存储器114可以包括但不限于是随机存储记忆体(Random Access Memory,RAM)、只读存储器(Read-Only Memory,ROM)、可擦除可编程只读存储器(Erasable Programmable Read Only Memory,EPROM)、或便携式只读存储器(Compact Disc Read-Only Memory,CD-ROM)。存储器114可以存储由处理器112执行的数据116和指令118,以使得终端设备102执行操作。The terminal device 102 may include a processor 112 and a memory 114. Processor 112 may be any suitable processing device (e.g., processor core, microprocessor, application specific integrated circuit (ASIC), field programmable gate array (FPGA), controller , microcontroller, etc.). The memory 114 may include, but is not limited to, Random Access Memory (RAM), Read-Only Memory (ROM), Erasable Programmable Read Only Memory (EPROM), Or portable read-only memory (Compact Disc Read-Only Memory, CD-ROM). The memory 114 may store data 116 and instructions 118 executed by the processor 112 to cause the terminal device 102 to perform operations.
在一些实施方式中,存储器114可以存储一个或多个模型120。例如,模型120可以是或可以另外包括各种机器学习模型,诸如神经网络(例如,深层神经网络)或其他类型的机器学习模型,包括非线性模型和/或线性模型。神经网络可以包括前馈神经网络、递归神经网络(例如,长短期记忆递归神经网络)、卷积神经网络或其他形式的神经网络。In some implementations, memory 114 may store one or more models 120 . For example, model 120 may be or may additionally include various machine learning models, such as neural networks (eg, deep neural networks) or other types of machine learning models, including nonlinear models and/or linear models. Neural networks may include feedforward neural networks, recurrent neural networks (eg, long short-term memory recurrent neural networks), convolutional neural networks, or other forms of neural networks.
在一些实施方式中,一个或多个模型120可以通过网络180从服务器130接收,存储在存储器114中,然后由一个或多个处理器112使用或另外实施。In some implementations, one or more models 120 may be received from server 130 over network 180, stored in memory 114, and then used by one or more processors 112 or otherwise implemented.
终端设备102还可以包括接收用户输入的一个或多个用户输入组件122。例如,用户输入组件122可以是对用户输入对象(例如,手指或触笔)的触摸敏感的触敏组件(例如,触敏显示屏或触摸板)。触敏组件可以用来实施虚拟键盘。其他示例用户输入组件包括麦克风、传统键盘或用户可以提供用户输入的其他装置。Terminal device 102 may also include one or more user input components 122 that receive user input. For example, user input component 122 may be a touch-sensitive component (eg, a touch-sensitive display screen or touch pad) that is sensitive to the touch of a user input object (eg, a finger or stylus). Touch-sensitive components can be used to implement virtual keyboards. Other example user input components include a microphone, a traditional keyboard, or other device through which a user can provide user input.
终端设备102还可以包括通信接口123,终端设备102可以通过通信接口123和服务器130通信连接,服务器130可以包括通信接口133,终端设备102可以通过通信接口123和服务器130的通信接口133通信连接,以此实现终端设备102和服务器130之间的数据交互。The terminal device 102 may also include a communication interface 123. The terminal device 102 may be communicatively connected to the server 130 through the communication interface 123. The server 130 may include a communication interface 133. The terminal device 102 may be communicatively connected to the communication interface 133 of the server 130 through the communication interface 123. In this way, data interaction between the terminal device 102 and the server 130 is achieved.
服务器130可以包括处理器132和存储器134。处理器132可以是可以是任何合适的处理设备(例如,处理器核、微处理器、特殊应用集成电路(application specific integrated circuit,ASIC)、现场可编程门阵列(field programmable gate array,FPGA)、控制器、微控制器等)。存储器134可以包括但不限于是随机存储记忆体(Random Access Memory,RAM)、只读存储器(Read-Only Memory,ROM)、可擦除可编程 只读存储器(Erasable Programmable Read Only Memory,EPROM)、或便携式只读存储器(Compact Disc Read-Only Memory,CD-ROM)。存储器134可以存储由处理器132执行的数据136和指令138,以使得服务器130执行操作。Server 130 may include processor 132 and memory 134. The processor 132 may be any suitable processing device (eg, processor core, microprocessor, application specific integrated circuit (ASIC), field programmable gate array (FPGA), controller, microcontroller, etc.). The memory 134 may include, but is not limited to, random access memory (Random Access Memory, RAM), read-only memory (Read-Only Memory, ROM), erasable and programmable memory. Read-only memory (Erasable Programmable Read Only Memory, EPROM), or portable read-only memory (Compact Disc Read-Only Memory, CD-ROM). Memory 134 may store data 136 and instructions 138 for execution by processor 132 to cause server 130 to perform operations.
如上所述,存储器134可以存储一个或多个机器学习模型140。例如,模型140可以是或者可以另外包括各种机器学习模型。示例机器学习模型包括神经网络或其他多层非线性模型。示例神经网络包括前馈神经网络、深层神经网络、递归神经网络和卷积神经网络。As mentioned above, memory 134 may store one or more machine learning models 140. For example, model 140 may be or may additionally include various machine learning models. Example machine learning models include neural networks or other multi-layered nonlinear models. Example neural networks include feedforward neural networks, deep neural networks, recurrent neural networks, and convolutional neural networks.
应理解,本申请实施例中的模型训练方法涉及AI相关的运算,在执行AI运算时,终端设备和服务器的指令执行架构不仅仅局限在图2所示的处理器结合存储器的架构。下面结合图3对本申请实施例提供的系统架构进行详细的介绍。It should be understood that the model training method in the embodiment of the present application involves AI-related operations. When performing AI operations, the instruction execution architecture of the terminal device and server is not limited to the processor-memory architecture shown in Figure 2. The system architecture provided by the embodiment of the present application will be introduced in detail below with reference to Figure 3 .
图3为本申请实施例提供的系统架构示意图。如图3所示,系统架构500包括执行设备510、训练设备520、数据库530、客户设备540、数据存储系统550以及数据采集系统560。Figure 3 is a schematic diagram of the system architecture provided by an embodiment of the present application. As shown in Figure 3, the system architecture 500 includes an execution device 510, a training device 520, a database 530, a client device 540, a data storage system 550 and a data collection system 560.
执行设备510包括计算模块511、I/O接口512、预处理模块513和预处理模块514。计算模块511中可以包括目标模型/规则501,预处理模块513和预处理模块514是可选的。The execution device 510 includes a computing module 511, an I/O interface 512, a preprocessing module 513 and a preprocessing module 514. The target model/rule 501 may be included in the calculation module 511, and the preprocessing module 513 and the preprocessing module 514 are optional.
数据采集设备560用于采集训练样本。训练样本可以为第一数据、第二数据等,其中,第一数据和第二数据可以为目标物体(例如机器人、车辆等)相关的状态信息、车辆相关的状态信息等。在采集到训练样本之后,数据采集设备560将这些训练样本存入数据库530。Data collection device 560 is used to collect training samples. The training samples may be first data, second data, etc., wherein the first data and the second data may be state information related to the target object (such as a robot, a vehicle, etc.), state information related to the vehicle, etc. After collecting the training samples, the data collection device 560 stores the training samples into the database 530 .
训练设备520可以基于数据库530中维护训练样本,对待训练的神经网络(例如本申请实施例中的强化学习模型以及目标神经网络等,其中,目标神经网络用于作为强化学习模型的对抗智能体),以得到目标模型/规则501。The training device 520 can maintain training samples based on the database 530, and the neural network to be trained (such as the reinforcement learning model and the target neural network in the embodiment of the present application, where the target neural network is used as an adversarial agent of the reinforcement learning model) , to get the target model/rule 501.
需要说明的是,在实际应用中,数据库530中维护的训练样本不一定都来自于数据采集设备560的采集,也有可能是从其他设备接收得到的。另外需要说明的是,训练设备520也不一定完全基于数据库530维护的训练样本进行目标模型/规则501的训练,也有可能从云端或其他地方获取训练样本进行模型训练,上述描述不应该作为对本申请实施例的限定。It should be noted that in actual applications, the training samples maintained in the database 530 are not necessarily collected from the data collection device 560, and may also be received from other devices. In addition, it should be noted that the training device 520 may not necessarily train the target model/rules 501 based entirely on the training samples maintained by the database 530. It may also obtain training samples from the cloud or other places for model training. The above description should not be used as a guarantee for this application. Limitations of Examples.
根据训练设备520训练得到的目标模型/规则501可以应用于不同的系统或设备中,如应用于图3所示的执行设备510,该执行设备510可以是终端,如手机终端,平板电脑,笔记本电脑,增强现实(augmented reality,AR)/虚拟现实(virtual reality,VR)设备,车载终端等,还可以是服务器等。The target model/rules 501 trained according to the training device 520 can be applied to different systems or devices, such as the execution device 510 shown in Figure 3. The execution device 510 can be a terminal, such as a mobile phone terminal, a tablet computer, and a notebook. Computers, augmented reality (AR)/virtual reality (VR) equipment, vehicle-mounted terminals, etc., and can also be servers, etc.
其中,目标模型/规则501可以用于实现目标任务,例如自动驾驶中的驾驶控制,机器人上的姿态控制等。Among them, the target model/rule 501 can be used to achieve target tasks, such as driving control in autonomous driving, attitude control on robots, etc.
具体的,训练设备520可以将训练后的模型传递至执行设备510。执行设备510可以为上述的目标物体。Specifically, the training device 520 can transfer the trained model to the execution device 510 . The execution device 510 may be the above-mentioned target object.
在图3中,执行设备510配置输入/输出(input/output,I/O)接口512,用于与外部设备进行数据交互,用户可以通过客户设备540向I/O接口512输入数据,或者执行设备510可以自动采集输入数据。In Figure 3, the execution device 510 is configured with an input/output (I/O) interface 512 for data interaction with external devices. The user can input data to the I/O interface 512 through the client device 540, or execute Device 510 can automatically collect input data.
预处理模块513和预处理模块514用于根据I/O接口512接收到的输入数据进行预处理。应理解,可以没有预处理模块513和预处理模块514或者只有的一个预处理模块。当不存在预处理模块513和预处理模块514时,可以直接采用计算模块511对输入数据进行处理。The preprocessing module 513 and the preprocessing module 514 are used to perform preprocessing according to the input data received by the I/O interface 512. It should be understood that there may be no preprocessing module 513 and 514 or only one preprocessing module. When the preprocessing module 513 and the preprocessing module 514 do not exist, the computing module 511 can be directly used to process the input data.
在执行设备510对输入数据进行预处理,或者在执行设备510的计算模块511执行计算等相关的处理过程中,执行设备510可以调用数据存储系统550中的数据、代码等以用于相应的处理,也可以将相应处理得到的数据、指令等存入数据存储系统550中。When the execution device 510 preprocesses input data, or when the calculation module 511 of the execution device 510 performs calculations and other related processes, the execution device 510 can call data, codes, etc. in the data storage system 550 for corresponding processing. , the data, instructions, etc. obtained by corresponding processing can also be stored in the data storage system 550.
最后,I/O接口512将处理结果提供给客户设备540,从而提供给用户,或者基于处理结果进行控制操作。Finally, the I/O interface 512 provides the processing results to the client device 540, thereby providing them to the user, or performing control operations based on the processing results.
在图3所示情况下,用户可以手动给定输入数据,该“手动给定输入数据”可以通过I/O接口512提供的界面进行操作。另一种情况下,客户设备540可以自动地向I/O接口512发送输入数据,如果要求客户设备540自动发送输入数据需要获得用户的授权,则用户可以在客户设备540中设置相应权限。用户可以在客户设备540查看执行设备510输出的结果,具体的呈现形式可以是显示、声音、动作等具体方式。客户设备540也可以作为数据采集端,采集如图所示输入I/O接口512的输入数据及输出I/O 接口512的输出结果作为新的样本数据,并存入数据库530。当然,也可以不经过客户设备540进行采集,而是由I/O接口512直接将如图所示输入I/O接口512的输入数据及输出I/O接口512的输出结果,作为新的样本数据存入数据库530。In the situation shown in FIG. 3 , the user can manually set the input data, and the "manually set input data" can be operated through the interface provided by the I/O interface 512 . In another case, the client device 540 can automatically send input data to the I/O interface 512. If requiring the client device 540 to automatically send the input data requires the user's authorization, the user can set corresponding permissions in the client device 540. The user can view the results output by the execution device 510 on the client device 540, and the specific presentation form may be display, sound, action, etc. The client device 540 can also be used as a data collection terminal to collect the input data and output I/O of the input I/O interface 512 as shown in the figure. The output result of the interface 512 is used as new sample data and stored in the database 530 . Of course, it is also possible to collect without going through the client device 540. Instead, the I/O interface 512 directly uses the input data input to the I/O interface 512 and the output result of the output I/O interface 512 as a new sample as shown in the figure. The data is stored in database 530.
值得注意的是,图3仅是本申请实施例提供的一种系统架构的示意图,图中所示设备、器件、模块等之间的位置关系不构成任何限制,例如,在图3中,数据存储系统550相对执行设备510是外部存储器,在其它情况下,也可以将数据存储系统550置于执行设备510中。应理解,上述执行设备510可以部署于客户设备540中。It is worth noting that Figure 3 is only a schematic diagram of a system architecture provided by an embodiment of the present application. The positional relationship between the devices, devices, modules, etc. shown in the figure does not constitute any limitation. For example, in Figure 3, the data The storage system 550 is an external memory relative to the execution device 510. In other cases, the data storage system 550 can also be placed in the execution device 510. It should be understood that the above execution device 510 may be deployed in the client device 540.
从模型的训练侧来说:From the training side of the model:
本申请实施例中,上述训练设备520可以获取到存储器(图3中未示出,可以集成于训练设备520或者与训练设备520分离部署)中存储的代码来实现本申请实施例中和模型训练相关的步骤。In the embodiment of the present application, the above-mentioned training device 520 can obtain the code stored in the memory (not shown in Figure 3, which can be integrated with the training device 520 or deployed separately from the training device 520) to implement the model training in the embodiment of the present application. Related steps.
本申请实施例中,训练设备520可以包括硬件电路(如专用集成电路(application specific integrated circuit,ASIC)、现场可编程门阵列(field-programmable gate array,FPGA)、通用处理器、数字信号处理器(digital signal processing,DSP)、微处理器或微控制器等等)、或这些硬件电路的组合,例如,训练设备520可以为具有执行指令功能的硬件系统,如CPU、DSP等,或者为不具有执行指令功能的硬件系统,如ASIC、FPGA等,或者为上述不具有执行指令功能的硬件系统以及具有执行指令功能的硬件系统的组合。In the embodiment of the present application, the training device 520 may include hardware circuits (such as application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), general-purpose processors, digital signal processors (digital signal processing, DSP, microprocessor or microcontroller, etc.), or a combination of these hardware circuits. For example, the training device 520 can be a hardware system with the function of executing instructions, such as a CPU, DSP, etc., or a combination of other hardware circuits. A hardware system with the function of executing instructions, such as ASIC, FPGA, etc., or a combination of the above-mentioned hardware systems without the function of executing instructions and a hardware system with the function of executing instructions.
应理解,训练设备520可以为不具有执行指令功能的硬件系统以及具有执行指令功能的硬件系统的组合,本申请实施例提供的中和模型训练相关的部分步骤还可以通过训练设备520中不具有执行指令功能的硬件系统来实现,这里并不限定。It should be understood that the training device 520 can be a combination of a hardware system that does not have the function of executing instructions and a hardware system that has the function of executing instructions. Some of the steps related to model training provided by the embodiments of the present application can also be implemented by the training device 520 that does not have the function of executing instructions. It is implemented by the hardware system that executes the instruction function, which is not limited here.
由于本申请实施例涉及大量神经网络的应用,为了便于理解,下面先对本申请实施例涉及的相关术语及神经网络等相关概念进行介绍。Since the embodiments of the present application involve the application of a large number of neural networks, in order to facilitate understanding, the relevant terms involved in the embodiments of the present application and related concepts such as neural networks are first introduced below.
(1)神经网络(1)Neural network
神经网络可以是由神经单元组成的,神经单元可以是指以xs(即输入数据)和截距1为输入的运算单元,该运算单元的输出可以为:
The neural network can be composed of neural units. The neural unit can refer to an operation unit that takes xs (ie, input data) and intercept 1 as input. The output of the operation unit can be:
其中,s=1、2、……n,n为大于1的自然数,Ws为xs的权重,b为神经单元的偏置。f为神经单元的激活函数(activation functions),用于将非线性特性引入神经网络中,来将神经单元中的输入信号转换为输出信号。该激活函数的输出信号可以作为下一层卷积层的输入,激活函数可以是sigmoid函数。神经网络是将多个上述单一的神经单元联结在一起形成的网络,即一个神经单元的输出可以是另一个神经单元的输入。每个神经单元的输入可以与前一层的局部接受域相连,来提取局部接受域的特征,局部接受域可以是由若干个神经单元组成的区域。Among them, s=1, 2,...n, n is a natural number greater than 1, Ws is the weight of xs, and b is the bias of the neural unit. f is the activation function of the neural unit, which is used to introduce nonlinear characteristics into the neural network to convert the input signal in the neural unit into an output signal. The output signal of this activation function can be used as the input of the next convolutional layer, and the activation function can be a sigmoid function. A neural network is a network formed by connecting multiple above-mentioned single neural units together, that is, the output of one neural unit can be the input of another neural unit. The input of each neural unit can be connected to the local receptive field of the previous layer to extract the features of the local receptive field. The local receptive field can be an area composed of several neural units.
(2)深度神经网络(2) Deep neural network
深度神经网络(Deep Neural Network,DNN),也称多层神经网络,可以理解为具有很多层隐含层的神经网络,这里的“很多”并没有特别的度量标准。从DNN按不同层的位置划分,DNN内部的神经网络可以分为三类:输入层,隐含层,输出层。一般来说第一层是输入层,最后一层是输出层,中间的层数都是隐含层。层与层之间是全连接的,也就是说,第i层的任意一个神经元一定与第i+1层的任意一个神经元相连。虽然DNN看起来很复杂,但是就每一层的工作来说,其实并不复杂,简单来说就是如下线性关系表达式:其中,是输入向量,是输出向量,是偏移向量,W是权重矩阵(也称系数),α()是激活函数。每一层仅仅是对输入向量经过如此简单的操作得到输出向量由于DNN层数多,则系数W和偏移向量的数量也就很多了。这些参数在DNN中的定义如下所述:以系数W为例:假设在一个三层的DNN中,第二层的第4个神经元到第三层的第2个神经元的线性系数定义为上标3代表系数W所在的层数,而下标对应的是输出的第三层索引2和输入的第二层索引4。 总结就是:第L-1层的第k个神经元到第L层的第j个神经元的系数定义为需要注意的是,输入层是没有W参数的。在深度神经网络中,更多的隐含层让网络更能够刻画现实世界中的复杂情形。理论上而言,参数越多的模型复杂度越高,“容量”也就越大,也就意味着它能完成更复杂的学习任务。训练深度神经网络的也就是学习权重矩阵的过程,其最终目的是得到训练好的深度神经网络的所有层的权重矩阵(由很多层的向量W形成的权重矩阵)。Deep Neural Network (DNN), also known as multi-layer neural network, can be understood as a neural network with many hidden layers. There is no special metric for "many" here. From the division of DNN according to the position of different layers, the neural network inside DNN can be divided into three categories: input layer, hidden layer, and output layer. Generally speaking, the first layer is the input layer, the last layer is the output layer, and the layers in between are hidden layers. The layers are fully connected, that is to say, any neuron in the i-th layer must be connected to any neuron in the i+1-th layer. Although DNN looks very complicated, the work of each layer is actually not complicated. Simply put, it is the following linear relationship expression: in, is the input vector, is the output vector, is the offset vector, W is the weight matrix (also called coefficient), and α() is the activation function. Each layer is just a pair of input vectors After such a simple operation, the output vector is obtained Since there are many DNN layers, the coefficient W and offset vector The number is also very large. The definitions of these parameters in DNN are as follows: Taking the coefficient W as an example: Assume that in a three-layer DNN, the linear coefficient from the fourth neuron in the second layer to the second neuron in the third layer is defined as The superscript 3 represents the number of layers where the coefficient W is located, and the subscript corresponds to the output third layer index 2 and the input second layer index 4. The summary is: the coefficient from the k-th neuron in layer L-1 to the j-th neuron in layer L is defined as It should be noted that the input layer has no W parameter. In deep neural networks, more hidden layers make the network more capable of describing complex situations in the real world. Theoretically, a model with more parameters has higher complexity and greater "capacity", which means it can complete more complex learning tasks. Training a deep neural network is the process of learning the weight matrix. The ultimate goal is to obtain the weight matrix of all layers of the trained deep neural network (a weight matrix formed by the vectors W of many layers).
(3)强化学习(reinforcement learning,RL),又称再励学习、评价学习或增强学习,是机器学习的范式和方法论之一,用于描述和解决智能体(agent)在与环境的交互过程中通过学习策略以达成回报最大化或实现特定目标的问题。(3) Reinforcement learning (RL), also known as reinforcement learning, evaluation learning or reinforcement learning, is one of the paradigms and methodologies of machine learning. It is used to describe and solve the interaction process between the agent and the environment. The problem of learning strategies to maximize returns or achieve specific goals.
强化学习的常见模型是标准的马尔可夫决策过程(markov decision process,MDP)。按给定条件,强化学习可分为基于模式的强化学习(model-based RL)和无模式强化学习(model-free RL),以及主动强化学习(active RL)和被动强化学习(passive RL)。强化学习的变体包括逆向强化学习、阶层强化学习和部分可观测系统的强化学习。求解强化学习问题所使用的算法可分为策略搜索算法和值函数(value function)算法两类。深度学习模型可以在强化学习中得到使用,形成深度强化学习。A common model for reinforcement learning is the standard Markov decision process (MDP). According to given conditions, reinforcement learning can be divided into model-based reinforcement learning (model-based RL) and model-free reinforcement learning (model-free RL), as well as active reinforcement learning (active RL) and passive reinforcement learning (passive RL). Variants of reinforcement learning include inverse reinforcement learning, hierarchical reinforcement learning, and reinforcement learning for partially observable systems. The algorithms used to solve reinforcement learning problems can be divided into two categories: policy search algorithms and value function algorithms. Deep learning models can be used in reinforcement learning to form deep reinforcement learning.
(4)损失函数(4)Loss function
在训练深度神经网络的过程中,因为希望深度神经网络的输出尽可能的接近真正想要预测的值,所以可以通过比较当前网络的预测值和真正想要的目标值,再根据两者之间的差异情况来更新每一层神经网络的权重向量(当然,在第一次更新之前通常会有初始化的过程,即为深度神经网络中的各层预先配置参数),比如,如果网络的预测值高了,就调整权重向量让它预测低一些,不断的调整,直到深度神经网络能够预测出真正想要的目标值或与真正想要的目标值非常接近的值。因此,就需要预先定义“如何比较预测值和目标值之间的差异”,这便是损失函数(loss function)或目标函数(objective function),它们是用于衡量预测值和目标值的差异的重要方程。其中,以损失函数举例,损失函数的输出值(loss)越高表示差异越大,那么深度神经网络的训练就变成了尽可能缩小这个loss的过程。In the process of training a deep neural network, because we hope that the output of the deep neural network is as close as possible to the value that we really want to predict, we can compare the predicted value of the current network with the really desired target value, and then based on the difference between the two to update the weight vector of each layer of the neural network according to the difference (of course, there is usually an initialization process before the first update, that is, preconfiguring parameters for each layer in the deep neural network). For example, if the predicted value of the network If it is high, adjust the weight vector to make its prediction lower, and continue to adjust until the deep neural network can predict the really desired target value or a value that is very close to the really desired target value. Therefore, it is necessary to define in advance "how to compare the difference between the predicted value and the target value". This is the loss function (loss function) or objective function (objective function), which is used to measure the difference between the predicted value and the target value. Important equations. Among them, taking the loss function as an example, the higher the output value (loss) of the loss function, the greater the difference. Then the training of the deep neural network becomes a process of reducing this loss as much as possible.
(5)反向传播算法(5)Back propagation algorithm
卷积神经网络可以采用误差反向传播(back propagation,BP)算法在训练过程中修正初始的超分辨率模型中参数的大小,使得超分辨率模型的重建误差损失越来越小。具体地,前向传递输入信号直至输出会产生误差损失,通过反向传播误差损失信息来更新初始的超分辨率模型中参数,从而使误差损失收敛。反向传播算法是以误差损失为主导的反向传播运动,旨在得到最优的超分辨率模型的参数,例如权重矩阵。The convolutional neural network can use the error back propagation (BP) algorithm to modify the size of the parameters in the initial super-resolution model during the training process, so that the reconstruction error loss of the super-resolution model becomes smaller and smaller. Specifically, forward propagation of the input signal until the output will produce an error loss, and the parameters in the initial super-resolution model are updated by back-propagating the error loss information, so that the error loss converges. The backpropagation algorithm is a backpropagation movement dominated by error loss, aiming to obtain the optimal parameters of the super-resolution model, such as the weight matrix.
(6)纳什均衡(nash equilibrium)(6) Nash equilibrium (nash equilibrium)
又称为非合作博弈均衡,是博弈论的一个重要术语。在一个博弈过程中,无论对方的策略选择如何,当事人一方都会选择某个确定的策略,则该策略被称作支配性策略。如果任意一位参与者在其他所有参与者的策略确定的情况下,其选择的策略是最优的,那么这个组合就被定义为纳什均衡。Also known as non-cooperative game equilibrium, it is an important term in game theory. In a game process, regardless of the other party's strategy choice, one party will choose a certain strategy, and this strategy is called a dominant strategy. If any player chooses the optimal strategy when the strategies of all other players are determined, then this combination is defined as a Nash equilibrium.
一个策略组合被称为纳什均衡,当每个博弈者的均衡策略都是为了达到自己期望收益的最大值,与此同时,其他所有博弈者也遵循这样的策略。A strategy combination is called a Nash equilibrium. When each player's equilibrium strategy is to maximize his or her expected return, at the same time, all other players also follow this strategy.
(7)强化学习模型(7) Reinforcement learning model
强化学习(reinforcement learning,RL),又称再励学习、评价学习或增强学习,是机器学习的范式和方法论之一,用于描述和解决智能体(agent)在与环境的交互过程中通过学习策略以达成回报最大化或实现特定目标的问题。Reinforcement learning (RL), also known as reinforcement learning, evaluation learning or reinforcement learning, is one of the paradigms and methodologies of machine learning. It is used to describe and solve the problem of how an agent learns during its interaction with the environment. Strategies to maximize returns or achieve specific goals.
强化学习的常见模型是标准的马尔可夫决策过程(markov decision process,MDP)。按给定条件,强化学习可分为基于模式的强化学习(model-based RL)和无模式强化学习(model-free RL),以及主动强化学习(active RL)和被动强化学习(passive RL)。强化学习的变体包括逆向强化学习、阶层强化学习和部分可观测系统的强化学习。求解强化学习问题所使用的算法可分为策略搜索算法和值函数(value function)算法两类。深度学习模型可以在强化学习中得到使用,形成深度强化学习。A common model for reinforcement learning is the standard Markov decision process (MDP). According to given conditions, reinforcement learning can be divided into model-based reinforcement learning (model-based RL) and model-free reinforcement learning (model-free RL), as well as active reinforcement learning (active RL) and passive reinforcement learning (passive RL). Variants of reinforcement learning include inverse reinforcement learning, hierarchical reinforcement learning, and reinforcement learning for partially observable systems. The algorithms used to solve reinforcement learning problems can be divided into two categories: policy search algorithms and value function algorithms. Deep learning models can be used in reinforcement learning to form deep reinforcement learning.
(8)智能体 (8)Intelligent body
智能体是人工智能领域中的一个概念,任何一个能够独立思想并能够同环境进行交互的实体都可以抽象为智能体。智能体的基本特性是:智能体能够根据环境的变化做出反应,然后自动的调整自己的行为和状态,不同的智能体还可以根据各自的意图与其他智能体进行交互。Agent is a concept in the field of artificial intelligence. Any entity that can think independently and interact with the environment can be abstracted into an agent. The basic characteristics of an intelligent agent are: the intelligent agent can react according to changes in the environment, and then automatically adjust its behavior and status. Different intelligent agents can also interact with other intelligent agents according to their own intentions.
在强化学习算法的应用过程中,经常需要线上环境进行交互来获得数据并进行训练。一般的做法是将现实世界的真实场景进行建模,生成虚拟仿真的线上环境。在这种情况下,如果训练环境和需要部署的真实环境具有微小差异,也很可能会导致训练得到的算法失效,造成在真实场景中的表现不及预期。In the application process of reinforcement learning algorithms, it is often necessary to interact with the online environment to obtain data and conduct training. The general approach is to model real scenes in the real world and generate an online environment for virtual simulation. In this case, if there is a slight difference between the training environment and the real environment that needs to be deployed, it is likely to cause the trained algorithm to fail, causing the performance in the real scenario to be lower than expected.
上述问题可以通过提升强化学习算法的鲁棒性来进行缓解。一种方法是通过在虚拟环境中引入假想干扰,在具有干扰的情况下训练强化学习算法,提升其应对干扰的能力,增强算法的鲁棒性和泛化性,也就是说,针对于待训练的强化学习模型,可以设置一个对抗智能体,该对抗智能体输出的数据可以和强化学习模型的输出数据共同执行任务,且抗智能体输出的数据可以作为执行目标任务的干扰。由于训练环境和部署环境的差异不可预见,现有训练方法主要抵抗某种特定干扰,然而,当真实环境中的变化与假想干扰不一致时,会导致算法效果下降。The above problems can be alleviated by improving the robustness of reinforcement learning algorithms. One method is to introduce imaginary interference in the virtual environment, train the reinforcement learning algorithm under the interference, improve its ability to deal with interference, and enhance the robustness and generalization of the algorithm. In other words, for the target to be trained For the reinforcement learning model, you can set up an adversarial agent. The data output by the adversarial agent can perform tasks together with the output data of the reinforcement learning model, and the data output by the anti-agent can serve as interference in executing the target task. Due to the unforeseen differences between the training environment and the deployment environment, existing training methods mainly resist certain specific interferences. However, when the changes in the real environment are inconsistent with the imaginary interference, the algorithm effect will decrease.
为了解决上述问题,参照图4,图4为本申请实施例提供的一种模型训练方法的流程示意,如图4所示,本申请实施例提供的一种模型训练方法包括:In order to solve the above problem, refer to Figure 4, which is a flow diagram of a model training method provided by an embodiment of the present application. As shown in Figure 4, a model training method provided by an embodiment of the present application includes:
401、通过第一强化学习模型,处理第一数据,以得到第一处理结果;其中,所述第一数据指示目标物体的状态,所述第一处理结果用于作为在所述目标物体上执行目标任务时的控制信息。401. Process the first data through the first reinforcement learning model to obtain a first processing result; wherein the first data indicates the state of the target object, and the first processing result is used as the execution method on the target object. Control information during target tasks.
其中,步骤401的执行主体可以为训练设备(示例性的,训练设备可以为终端设备或者服务器),具体可以参照上述实施例中的描述,这里不再赘述。The execution subject of step 401 may be a training device (for example, the training device may be a terminal device or a server). For details, reference may be made to the description in the above embodiments, which will not be described again here.
在一种可能的实现中,训练设备可以获取到模型训练的对象(第一强化学习模型)以及训练样本(第一数据)。In a possible implementation, the training device can obtain the model training object (first reinforcement learning model) and the training sample (first data).
在一种可能的实现中,所述第一数据为机器人相关的状态信息;所述目标任务为机器人的姿态操控,所述第一处理结果为机器人的姿态控制信息。In a possible implementation, the first data is status information related to the robot; the target task is attitude control of the robot, and the first processing result is attitude control information of the robot.
在一种可能的实现中,机器人相关的状态信息可以包括但不限于机器人的位置、速度、自身所处的场景相关的信息(例如障碍物信息),机器人的位置、速度可以包括各个关节的状态(位置、角度、速度、加速度等)等信息。In a possible implementation, the robot-related status information may include but is not limited to the robot's position and speed, and information related to the scene it is in (such as obstacle information). The robot's position and speed may include the status of each joint. (position, angle, speed, acceleration, etc.) and other information.
在一种可能的实现中,第一强化学习模型可以根据输入的数据,得到机器人的姿态控制信息,姿态控制信息可以包括机器人的各个关节的控制信息,基于姿态控制信息可以执行机器人的姿态操控任务。In a possible implementation, the first reinforcement learning model can obtain the attitude control information of the robot based on the input data. The attitude control information can include the control information of each joint of the robot, and the attitude control task of the robot can be performed based on the attitude control information. .
在一种可能的实现中,所述第一数据为车辆相关的状态信息;所述目标任务为车辆的自动驾驶,所述第一处理结果为车辆的驾驶控制信息。In a possible implementation, the first data is vehicle-related status information; the target task is automatic driving of the vehicle, and the first processing result is the driving control information of the vehicle.
在一种可能的实现中,车辆相关的状态信息可以包括但不限于车辆的位置、速度、自身所处的场景相关的信息(例如行驶路面的信息、障碍物信息、行人信息、周围车辆的信息)。In a possible implementation, the vehicle-related status information may include but is not limited to the vehicle's position, speed, and information related to the scene in which it is located (such as driving road information, obstacle information, pedestrian information, and surrounding vehicle information). ).
在一种可能的实现中,第一强化学习模型可以根据输入的数据,得到车辆的驾驶控制信息,驾驶控制信息可以包括车辆的速度、方向、行驶轨迹等信息。In a possible implementation, the first reinforcement learning model can obtain the driving control information of the vehicle based on the input data. The driving control information can include the vehicle's speed, direction, driving trajectory and other information.
在一种可能的实现中,第一强化学习模型可以为初始化的模型、或者是模型训练过程中一次迭代的输出。In a possible implementation, the first reinforcement learning model may be an initialized model or the output of an iteration in the model training process.
在一种可能的实现中,在模型训练的前馈过程中,可以通过第一强化学习模型,处理第一数据,以得到第一处理结果。所述第一处理结果用于作为在所述目标物体上执行目标任务时的控制信息,例如,所述目标任务为机器人的姿态操控,所述第一处理结果为机器人的姿态控制信息;或者,所述目标任务为车辆的自动驾驶,所述第一处理结果为车辆的驾驶控制信息。In a possible implementation, during the feedforward process of model training, the first data can be processed through the first reinforcement learning model to obtain the first processing result. The first processing result is used as control information when performing a target task on the target object. For example, the target task is the attitude control of the robot, and the first processing result is the attitude control information of the robot; or, The target task is automatic driving of the vehicle, and the first processing result is the driving control information of the vehicle.
可选的,在一种可能的实现中,第一处理结果可以作为执行目标任务时施加在目标物体上的硬约束。Optionally, in a possible implementation, the first processing result can be used as a hard constraint imposed on the target object when performing the target task.
应理解,本申请实施例中的强化学习模型包括但不限于深度神经网络、贝叶斯神经网络等。It should be understood that the reinforcement learning models in the embodiments of this application include but are not limited to deep neural networks, Bayesian neural networks, etc.
402、通过第一目标神经网络,处理所述第一数据,以得到第二处理结果;其中,所述第一处理结果用于执行目标任务,所述第二处理结果用于作为执行所述目标任务时的干扰,所述第一目标神经网络为从多个第一神经网络中选择的,每个所述第一神经网络为对第一初始神经网络进行迭代训练的过程得 到的一个迭代结果。402. Process the first data through the first target neural network to obtain a second processing result; wherein the first processing result is used to execute the target task, and the second processing result is used as the basis for executing the target. interference during the task, the first target neural network is selected from a plurality of first neural networks, and each first neural network is obtained by iteratively training the first initial neural network. The result of an iteration.
在一种可能的实现中,训练设备可以获取到针对于强化学习模型的对抗智能体,该对抗智能体可以输出针对于目标任务的干扰信息。In one possible implementation, the training device can obtain an adversarial agent for the reinforcement learning model, and the adversarial agent can output interference information for the target task.
在现有的实现中,可以训练一个用于输出干扰信息的对抗智能体,该干扰信息只针对于目标任务进行一种干扰,在本申请实施例中,一方面,可以训练多个用于输出干扰信息的对抗智能体,不同对抗智能体输出的干扰信息可以针对于目标任务进行不同类的干扰,另一方面,在训练对抗智能体时,不仅仅利用当前最新迭代得到的对抗智能体来输出针对于目标任务的干扰,还可以利用历史上对抗智能体的历史训练结果(历史迭代过程中得到的对抗智能体)来输出针对于目标任务的干扰,从而可以得到适配于不同的场景下针对于目标任务的更有效的干扰,从而提高模型的训练效果和泛化性。In the existing implementation, an adversarial agent for outputting interference information can be trained. The interference information only performs one kind of interference for the target task. In the embodiment of the present application, on the one hand, multiple adversarial agents for outputting interference information can be trained. Adversarial agents that interfere with information. The interference information output by different adversarial agents can interfere with different types of target tasks. On the other hand, when training adversarial agents, not only the adversarial agents obtained in the latest iteration are used to output For interference on the target task, the historical training results of historical adversarial agents (adversarial agents obtained during the historical iteration process) can also be used to output interference on the target task, so that the system can be adapted to different scenarios. More effective interference with the target task, thereby improving the training effect and generalization of the model.
应理解,本申请实施例中的第一目标神经网络包括但不限于深度神经网络、贝叶斯神经网络等。It should be understood that the first target neural network in the embodiment of this application includes but is not limited to deep neural network, Bayesian neural network, etc.
在一种可能的实现中,在确定用于输出作为第一强化学习模型的干扰信息的对抗智能体时,可以从所述多个第一神经网络中选择所述第一目标神经网络,其中,每个所述第一神经网络为对第一初始神经网络进行迭代训练的过程得到的一个迭代结果。In a possible implementation, when determining an adversarial agent for outputting interference information as the first reinforcement learning model, the first target neural network may be selected from the plurality of first neural networks, wherein, Each first neural network is an iterative result obtained by iteratively training the first initial neural network.
例如,在对第一初始神经网络进行迭代训练的过程中可以得到神经网络1、神经网络2、神经网络3、神经网络4、神经网络5、神经网络6、神经网络7、神经网络8、神经网络9,在确定用于输出作为第一强化学习模型的干扰信息的对抗智能体时,可以从集合[神经网络1、神经网络2、神经网络3、神经网络4、神经网络5、神经网络6、神经网络7、神经网络8、神经网络9]中选择一个神经网络。For example, in the process of iterative training of the first initial neural network, we can obtain neural network 1, neural network 2, neural network 3, neural network 4, neural network 5, neural network 6, neural network 7, neural network 8, neural network Network 9, when determining the adversarial agent for outputting interference information as the first reinforcement learning model, can be selected from the set [Neural Network 1, Neural Network 2, Neural Network 3, Neural Network 4, Neural Network 5, Neural Network 6 , Neural Network 7, Neural Network 8, Neural Network 9] Select a neural network.
在一种可能的实现中,所述从多个第一神经网络中选择所述第一目标神经网络,包括:基于所述多个第一神经网络中每个第一神经网络对应的第一选择概率,从多个第一神经网络中选择所述第一目标神经网络。也就是说,每个第一神经网络可以对应配置一个概率(即上述描述的第一选择概率),在从多个第一神经网络中选择所述第一目标神经网络时,可以基于多个第一神经网络对应的概率分布来进行采样并基于采样结果进行网络选择。In a possible implementation, selecting the first target neural network from a plurality of first neural networks includes: based on a first selection corresponding to each first neural network in the plurality of first neural networks. probability, selecting the first target neural network from a plurality of first neural networks. That is to say, each first neural network can be configured with a corresponding probability (ie, the first selection probability described above). When selecting the first target neural network from multiple first neural networks, the first neural network can be selected based on multiple first neural networks. A probability distribution corresponding to a neural network is used to sample and the network is selected based on the sampling results.
接下来介绍第一选择概率:Next, the first choice probability is introduced:
在一种可能的实现中,每个第一神经网络处理数据得到的处理结果用于作为执行所述目标任务时的干扰,且所述第一选择概率与对应的第一神经网络输出的处理结果对所述目标任务的干扰程度正相关。其中,在进行强化学习模型以及对抗智能体的模型更新时,可以得到奖励值,该奖励值一方面可以表征出该强化学习模型输出的数据在执行目标任务时的优良,还可以表征出对抗智能体输出的干扰信息对于目标任务的干扰程度,可以基于奖励值对第一神经网络对应的概率分布进行更新,以使得所述第一选择概率与对应的第一神经网络输出的处理结果对所述目标任务的干扰程度正相关。通过上述方式,一方面,针对于输出干扰程较大的对抗智能体,其对应的被采样概率较大,使得更容易被采样到,提高了对强化学习模型的干扰程度,另一方面,针对于输出干扰程较小的对抗智能体,虽然其对应的被采样概率较小,但仍有可能被采样到,可以提高对强化学习模型的干扰的丰富程度,提高网络的泛化性。In a possible implementation, the processing result obtained by each first neural network processing data is used as interference when executing the target task, and the first selection probability is the same as the processing result output by the corresponding first neural network. The degree of interference with the target task is positively correlated. Among them, when updating the model of the reinforcement learning model and the adversarial agent, a reward value can be obtained. On the one hand, the reward value can represent the excellence of the data output by the reinforcement learning model in performing the target task, and can also represent the adversarial intelligence. According to the degree of interference of the interference information output by the body to the target task, the probability distribution corresponding to the first neural network can be updated based on the reward value, so that the first selection probability and the corresponding processing result output by the first neural network have a positive impact on the first neural network. The degree of interference from the target task is positively related. Through the above method, on the one hand, for an adversarial agent with a large output interference range, its corresponding sampling probability is larger, making it easier to be sampled, which increases the degree of interference to the reinforcement learning model. On the other hand, for For adversarial agents with small output interference range, although their corresponding sampling probability is small, they may still be sampled, which can increase the richness of interference to the reinforcement learning model and improve the generalization of the network.
在一种可能的实现中,上述概率分布可以为纳什均衡分布。概率分布可以基于在根据强化学习模型前馈时得到的数据和干扰信息执行目标任务得到的奖励值通过纳什均衡计算得到,在迭代的过程中,概率分布可以被更新。In a possible implementation, the above probability distribution can be a Nash equilibrium distribution. The probability distribution can be calculated through Nash equilibrium based on the reward value obtained when performing the target task based on the data and interference information obtained during the feedforward of the reinforcement learning model. During the iteration process, the probability distribution can be updated.
本申请实施例通过控制对抗智能体的行为空间,改变对抗智能体的干扰强度,使得强化学习策略对于强弱干扰均鲁棒。此外,通过引入博弈论优化框架,使用历史策略增加对抗智能体的多样性,使得强化学习策略对于不同策略的干扰更加鲁棒。The embodiment of the present application controls the behavior space of the adversarial agent and changes the interference intensity of the adversarial agent, making the reinforcement learning strategy robust to both strong and weak interference. In addition, by introducing a game theory optimization framework and using historical strategies to increase the diversity of adversarial agents, the reinforcement learning strategy is more robust to interference from different strategies.
在一种可能的实现中,在模型训练的前馈过程中,可以通过第一目标神经网络,处理所述第一数据,以得到第二处理结果,第二处理结果用于作为执行所述目标任务时的干扰信息。In a possible implementation, during the feedforward process of model training, the first data can be processed through a first target neural network to obtain a second processing result, and the second processing result is used as the basis for executing the target. Interfering information during the task.
例如,在机器人控制的场景中,第二处理结果可以为对机器人上至少一个关节施加的作用力或者力矩,又例如,在自动驾驶的场景中,第二处理结果可以为对车辆的路况上施加障碍物或者其他能够影响到驾驶策略的障碍信息。For example, in a robot control scenario, the second processing result may be a force or moment applied to at least one joint on the robot. For example, in an autonomous driving scenario, the second processing result may be a force or moment exerted on the road conditions of the vehicle. Obstacles or other obstacle information that can affect driving strategies.
在一种可能的实现中,为了提高对强化学习模型的干扰的丰富性,可以训练多个对抗智能体,且,针对于多个对抗智能体中的每个对抗体,可以从训练时的多个迭代结果中选择对强化学习模型施加干扰 的对抗智能体。In a possible implementation, in order to improve the richness of interference to the reinforcement learning model, multiple adversarial agents can be trained, and for each adversarial agent in the multiple adversarial agents, multiple adversarial agents can be trained from Choose to interfere with the reinforcement learning model among the iteration results. of adversarial agents.
例如,针对于第一初始神经网络,在对第一初始神经网络进行迭代训练的过程中可以得到神经网络A1、神经网络A2、神经网络A3、神经网络A4、神经网络A5、神经网络A6、神经网络A7、神经网络A8、神经网络A9,在确定用于输出作为第一强化学习模型的干扰信息的对抗智能体时,可以从集合[神经网络A1、神经网络A2、神经网络A3、神经网络A4、神经网络A5、神经网络A6、神经网络A7、神经网络A8、神经网络A9]中选择一个神经网络,即上述实施例中的第一目标神经网络。针对于不同于第一初始神经网络的第二初始神经网络,在对第二初始神经网络进行迭代训练的过程中可以得到神经网络B1、神经网络B2、神经网络B3、神经网络B4、神经网络B5、神经网络B6、神经网络B7、神经网络B8、神经网络B9,在确定用于输出作为第一强化学习模型的干扰信息的对抗智能体时,可以从集合[神经网络B1、神经网络B2、神经网络B3、神经网络B4、神经网络B5、神经网络B6、神经网络B7、神经网络B8、神经网络B9]中选择一个神经网络,即第二目标神经网络。可以将第一目标神经网络和第二目标神经网络输出的数据作为施加在第一强化学习模型上的干扰信息。For example, for the first initial neural network, in the process of iterative training of the first initial neural network, neural network A1, neural network A2, neural network A3, neural network A4, neural network A5, neural network A6, neural network Network A7, neural network A8, and neural network A9, when determining the adversarial agent used to output interference information as the first reinforcement learning model, can be obtained from the set [neural network A1, neural network A2, neural network A3, neural network A4 , neural network A5, neural network A6, neural network A7, neural network A8, neural network A9], which is the first target neural network in the above embodiment. For the second initial neural network that is different from the first initial neural network, in the process of iterative training of the second initial neural network, neural network B1, neural network B2, neural network B3, neural network B4, and neural network B5 can be obtained , neural network B6, neural network B7, neural network B8, neural network B9, when determining the adversarial agent used to output interference information as the first reinforcement learning model, it can be obtained from the set [neural network B1, neural network B2, neural network Select a neural network among the network B3, neural network B4, neural network B5, neural network B6, neural network B7, neural network B8, and neural network B9], that is, the second target neural network. The data output by the first target neural network and the second target neural network can be used as interference information applied to the first reinforcement learning model.
具体的,在一种可能的实现中,在根据第二目标神经网络进行的前馈过程中,可以通过第二目标神经网络,处理所述第一数据,以得到第四处理结果;其中,所述第二处理结果用于作为执行所述目标任务时的干扰,所述第二目标神经网络为从多个第二神经网络中选择的,每个所述第二神经网络为对第二初始神经网络进行迭代训练的过程得到的一个迭代结果;所述第一初始神经网络和所述第二初始神经网络不同。Specifically, in a possible implementation, during the feedforward process according to the second target neural network, the first data can be processed through the second target neural network to obtain a fourth processing result; wherein, The second processing result is used as interference when executing the target task, the second target neural network is selected from a plurality of second neural networks, and each of the second neural networks is a pair of second initial neural networks. An iterative result obtained by the iterative training process of the network; the first initial neural network and the second initial neural network are different.
在一种可能的实现中,所述第二处理结果和所述第四处理结果的干扰类型不同。In a possible implementation, the interference types of the second processing result and the fourth processing result are different.
例如,干扰类型可以为在执行目标任务时施加的干扰的类别,例如,施加力、施加力矩、增加障碍物、改变路况、改变天气等等。For example, the interference type may be a category of interference applied when performing the target task, such as applying force, applying torque, adding obstacles, changing road conditions, changing weather, etc.
在一种可能的实现中,所述第二处理结果和所述第四处理结果的干扰对象不同。In a possible implementation, the interference objects of the second processing result and the fourth processing result are different.
例如,机器人可以包括多个关节,对不同的关节、或者不同的关节组施加力可以认为干扰对象的不同。也就是,第二处理结果和所述第四处理结果是对不同的关节、或者不同的关节组施加的力。For example, the robot may include multiple joints, and applying force to different joints or different joint groups may be considered to be different interference objects. That is, the second processing result and the fourth processing result are forces applied to different joints or different joint groups.
在一种可能的实现中,所述第一目标神经网络用于根据所述第一数据,从第一数值范围内确定所述第二处理结果,所述第二目标神经网络用于根据所述第一数据,从第二数值范围内确定所述第四处理结果,所述第二数值范围和所述第一数值范围不同。In a possible implementation, the first target neural network is used to determine the second processing result from a first numerical range according to the first data, and the second target neural network is used to determine the second processing result according to the first numerical range. The first data determines the fourth processing result from a second numerical range, and the second numerical range is different from the first numerical range.
例如,第二处理结果和第四处理结果都是对机器人关节施加的力,第一目标神经网络所确定出的力的大小的最大值是A1,第二目标神经网络所确定出的力的大小的最大值是A2,A1和A2不同。For example, the second processing result and the fourth processing result are both forces exerted on the robot joints. The maximum value of the force determined by the first target neural network is A1, and the maximum value of the force determined by the second target neural network is The maximum value of is A2, A1 and A2 are different.
403、根据所述第一处理结果和所述第二处理结果,执行所述目标任务,得到第三处理结果。403. According to the first processing result and the second processing result, execute the target task to obtain a third processing result.
其中,第一处理结果可以作为执行目标任务时的硬约束,也就是第一处理结果可以作为执行目标任务时目标物体需要满足的控制信息,第二处理结果可以为执行目标任务时施加在目标物体上的干扰,第三处理结果可以为目标物体执行目标任务时(或者之后)的状态,该第三处理结果可以用于确定奖励值。Among them, the first processing result can be used as a hard constraint when executing the target task, that is, the first processing result can be used as the control information that the target object needs to satisfy when executing the target task, and the second processing result can be applied to the target object when executing the target task. The third processing result can be the state of the target object when (or after) it performs the target task, and the third processing result can be used to determine the reward value.
应理解,第一处理结果和第二处理结果可以为确定第三处理结果的部分数据,在还可以包括除了第二处理结果之外的其他干扰信息时(例如上述实施例中介绍的第四处理结果),可以基于第一处理结果、第二处理结果以及其他的处理结果来执行目标任务,以得到第三处理结果。It should be understood that the first processing result and the second processing result may be part of the data for determining the third processing result, and may also include other interference information in addition to the second processing result (such as the fourth processing introduced in the above embodiment). result), the target task can be executed based on the first processing result, the second processing result and other processing results to obtain a third processing result.
404、根据所述第三处理结果,更新所述第一强化学习模型,以得到更新后的第一强化学习模型。404. Update the first reinforcement learning model according to the third processing result to obtain an updated first reinforcement learning model.
在一种可能的实现中,在进行模型的更新时,可以根据所述第三处理结果,更新所述第一强化学习模型,以得到更新后的第一强化学习模型。In a possible implementation, when updating the model, the first reinforcement learning model can be updated according to the third processing result to obtain an updated first reinforcement learning model.
例如,在更新第一强化学习模型时,可以最大化所获得的累计奖励,更新方法可以采取连续动作空间的强化学习算法,可选的,可以采取可信区域策略优化算法(trust region policy optimization,TRPO)。For example, when updating the first reinforcement learning model, the cumulative reward obtained can be maximized. The update method can adopt the reinforcement learning algorithm of the continuous action space. Alternatively, the trust region policy optimization algorithm (trust region policy optimization) can be adopted. TRPO).
其中,第一目标神经网络和第二目标神经网络可以执行不同的对抗任务,在一种可能的实现中,可以在多个对抗任务中(示例性的,按次序)选取本次训练所需要的对抗任务。Among them, the first target neural network and the second target neural network can perform different adversarial tasks. In a possible implementation, the ones required for this training can be selected from multiple adversarial tasks (for example, in order). Confrontation mission.
在一种可能的实现中,可以从对抗智能体的历史策略集合中,根据纳什均衡分布,抽样选择对抗智能体历史策略,用于对抗强化学习策略。在训练环境中,部署选择的对抗智能体策略和当前的强化学习策略,进行采样,得到所需的训练样本。使用的得到的训练样本训练强化学习策略。也就是可以根据所 述第一处理结果、所述第二处理结果以及第四处理结果,更新所述第一强化学习模型,以得到更新后的第一强化学习模型(也就是根据所述第一处理结果、所述第二处理结果以及第四处理结果,执行目标任务,以得到第三处理结果,并根据第三处理结果来更新第一强化学习模型)。In a possible implementation, the historical strategy of the adversary agent can be sampled from the historical strategy set of the adversary agent according to the Nash equilibrium distribution, and used for the adversarial reinforcement learning strategy. In the training environment, deploy the selected adversarial agent strategy and the current reinforcement learning strategy, perform sampling, and obtain the required training samples. Use the obtained training samples to train the reinforcement learning strategy. That is to say, according to the According to the first processing result, the second processing result and the fourth processing result, the first reinforcement learning model is updated to obtain an updated first reinforcement learning model (that is, according to the first processing result, the The second processing result and the fourth processing result are executed, and the target task is performed to obtain the third processing result, and the first reinforcement learning model is updated according to the third processing result).
在一种可能的实现中,针对于各个对抗任务采样一个对抗智能体之后,可以将强化学习策略和对抗智能体更新后的策略加入纳什均衡矩阵,并计算纳什均衡,得到强化学习和对抗智能体的纳什均衡分布(也就是上述第一选择概率以及后续介绍的第二选择概率)。具体的,所述根据所述第一处理结果以及所述第二处理结果,更新所述第一强化学习模型,包括:根据所述第一处理结果以及所述第二处理结果,得到所述目标任务对应的奖励值;根据所述奖励值,更新所述第一强化学习模型;进而,可以根据所述奖励值,更新所述第一目标神经网络对应的第一选择概率。In one possible implementation, after sampling an adversarial agent for each adversarial task, the reinforcement learning strategy and the updated strategy of the adversarial agent can be added to the Nash equilibrium matrix, and the Nash equilibrium can be calculated to obtain the reinforcement learning and adversarial agents. Nash equilibrium distribution (that is, the above-mentioned first choice probability and the second choice probability introduced later). Specifically, updating the first reinforcement learning model according to the first processing result and the second processing result includes: obtaining the target according to the first processing result and the second processing result. The reward value corresponding to the task; the first reinforcement learning model is updated according to the reward value; further, the first selection probability corresponding to the first target neural network can be updated according to the reward value.
在一种可能的实现中,在对对抗智能体进行迭代训练的过程中,也可以从强化学习模型的历史迭代结果中选择当前轮次参与训练过程的强化学习模型。例如可以基于概率采样的方式,相似之处可以参照上述实施例中关于对对抗智能体进行采样的过程。In a possible implementation, during the iterative training process of the adversarial agent, the reinforcement learning model participating in the training process in the current round can also be selected from the historical iteration results of the reinforcement learning model. For example, it can be based on probability sampling. For similarities, refer to the process of sampling the adversarial agent in the above embodiment.
在一种可能的实现中,可以通过第二强化学习模型,处理第二数据,以得到第五处理结果;其中,所述第二强化学习模型为从包括所述更新后的第一强化学习模型在内的多个强化学习模型中选择的,每个所述强化学习模型为对初始强化学习模型进行迭代训练的过程得到的一个迭代结果;所述第二数据指示目标物体的状态,所述第五处理结果用于作为在所述目标物体上执行所述目标任务时的控制信息;通过第三目标神经网络,处理所述第二数据,以得到第六处理结果;所述第三目标神经网络属于所述多个第一神经网络;所述第六处理结果用于作为执行所述目标任务时的干扰信息;根据所述第五处理结果和所述第六处理结果,执行所述目标任务,得到第七处理结果;根据所述第七处理结果,更新所述第三目标神经网络,以得到更新后的第三目标神经网络。In a possible implementation, the second data can be processed through a second reinforcement learning model to obtain a fifth processing result; wherein the second reinforcement learning model is derived from the updated first reinforcement learning model. Selected from a plurality of reinforcement learning models, each of the reinforcement learning models is an iterative result obtained from the iterative training process of the initial reinforcement learning model; the second data indicates the state of the target object, and the third The fifth processing result is used as control information when performing the target task on the target object; the second data is processed through a third target neural network to obtain a sixth processing result; the third target neural network Belonging to the plurality of first neural networks; the sixth processing result is used as interference information when executing the target task; executing the target task according to the fifth processing result and the sixth processing result, Obtain a seventh processing result; update the third target neural network according to the seventh processing result to obtain an updated third target neural network.
在一种可能的实现中,可以从所述多个强化学习模型中选择所述第二强化学习模型。In a possible implementation, the second reinforcement learning model may be selected from the plurality of reinforcement learning models.
在一种可能的实现中,所述从所述多个强化学习模型中选择所述第二强化学习模型,包括:基于所述多个强化学习模型中每个强化学习模型对应的第二选择概率,从多个强化学习模型中选择所述第二强化学习模型。In a possible implementation, selecting the second reinforcement learning model from the plurality of reinforcement learning models includes: based on the second selection probability corresponding to each reinforcement learning model in the plurality of reinforcement learning models. , selecting the second reinforcement learning model from a plurality of reinforcement learning models.
在一种可能的实现中,所述第二选择概率与对应的强化学习模型输出的处理结果在执行目标任务时正向的执行效果正相关。其中,在进行强化学习模型以及对抗智能体的模型更新时,可以得到奖励值,该奖励值一方面可以表征出该强化学习模型输出的数据在执行目标任务时的优良,可以基于奖励值对强化学习模型对应的概率分布进行更新,以使得所述第二选择概率与对应的强化学习模型输出的处理结果在执行目标任务时的正向的执行效果正相关。In a possible implementation, the second selection probability is positively related to the positive execution effect of the processing result output by the corresponding reinforcement learning model when executing the target task. Among them, when updating the reinforcement learning model and the model of the adversarial agent, a reward value can be obtained. On the one hand, the reward value can represent the excellence of the data output by the reinforcement learning model in performing the target task, and can be used to strengthen the reinforcement based on the reward value. The probability distribution corresponding to the learning model is updated so that the second selection probability is positively related to the positive execution effect of the processing result output by the corresponding reinforcement learning model when executing the target task.
在一种可能的实现中,可以从强化学习智能体的历史策略集合中,根据纳什均衡分布,抽样选择强化学习智能体的历史策略,用于对抗智能体策略更新。在训练环境中,部署选择的强化学习策略和当前的对抗智能体策略,进行采样,得到所需的训练样本。使用的得到的训练样本训练对抗智能体策略。In a possible implementation, the historical strategy of the reinforcement learning agent can be sampled and selected from the historical strategy collection of the reinforcement learning agent according to the Nash equilibrium distribution for use in the strategy update of the countermeasure agent. In the training environment, deploy the selected reinforcement learning strategy and the current adversarial agent strategy, perform sampling, and obtain the required training samples. Use the obtained training samples to train the adversarial agent strategy.
本申请实施例提供了一种模型训练方法,所述方法包括:通过第一强化学习模型,处理第一数据,以得到第一处理结果;其中,所述第一数据指示目标物体的状态,所述第一处理结果用于作为在所述目标物体上执行目标任务时的控制信息;通过第一目标神经网络,处理所述第一数据,以得到第二处理结果;其中,所述第二处理结果用于作为执行所述目标任务时的干扰信息,所述第一目标神经网络为从多个第一神经网络中选择的,每个所述第一神经网络为对第一初始神经网络进行迭代训练的过程得到的一个迭代结果;根据所述第一处理结果和所述第二处理结果,执行所述目标任务,得到第三处理结果;根据所述第三处理结果,更新所述第一强化学习模型,以得到更新后的第一强化学习模型。通过上述方式,在训练对抗智能体时,不仅仅利用当前最新迭代得到的对抗智能体来输出针对于目标任务的干扰,还可以利用历史上对抗智能体的历史训练结果(历史迭代过程中得到的对抗智能体)来输出针对于目标任务的干扰,从而可以得到适配于不同的场景下针对于目标任务的更有效的干扰,从而提高模型的训练效果和泛化性。Embodiments of the present application provide a model training method. The method includes: processing first data through a first reinforcement learning model to obtain a first processing result; wherein the first data indicates the state of the target object, and the first data indicates the state of the target object. The first processing result is used as control information when performing a target task on the target object; the first data is processed through the first target neural network to obtain a second processing result; wherein, the second processing The result is used as interference information when executing the target task. The first target neural network is selected from a plurality of first neural networks, and each of the first neural networks iterates the first initial neural network. An iterative result obtained in the training process; according to the first processing result and the second processing result, the target task is executed to obtain a third processing result; according to the third processing result, the first reinforcement is updated Learning model to obtain the updated first reinforcement learning model. Through the above method, when training adversarial agents, not only the adversarial agents obtained in the latest iteration are used to output interference for the target task, but also the historical training results of adversarial agents in history (obtained during the historical iteration process) are used. Adversarial agent) to output interference for the target task, so that more effective interference for the target task can be obtained that is adapted to different scenarios, thereby improving the training effect and generalization of the model.
接下来以目标物体为机器人,目标任务为机器人控制为例介绍本申请实施例的一个软件架构:Next, taking the target object as a robot and the target task as robot control as an example, we will introduce a software architecture of the embodiment of this application:
参照图5,图5示出了一个机器人控制系统,如图5所示,机器人控制系统可以包括:状态感知和 处理模块、鲁棒性决策模块、机器人控制模块。Referring to Figure 5, Figure 5 shows a robot control system. As shown in Figure 5, the robot control system may include: state awareness and processing module, robust decision-making module, and robot control module.
其中,关于状态感知和处理模块:该模块的作用是感知机器人的信息(例如上述实施例中介绍的用于描述目标物体的状态的信息,例如第一数据、第二数据等)。具体地,综合各个传感器所传递的信息,判断机器人自身状态,包括机器人的基础信息(位置,速度),各个关节的状态(位置,角度,速度,加速度)等信息,并将这些信息传递给决策模块Among them, regarding the state sensing and processing module: the function of this module is to sense the information of the robot (such as the information used to describe the state of the target object introduced in the above embodiment, such as the first data, the second data, etc.). Specifically, it combines the information transmitted by each sensor to determine the robot's own status, including the robot's basic information (position, speed), the status of each joint (position, angle, speed, acceleration) and other information, and transfers this information to decision-making module
关于鲁棒性决策模块:该模块的作用是根据当前机器人状态和正在执行的任务,输出未来一段时间内的上层行为决策(例如上述实施例中介绍的在所述目标物体上执行目标任务时的控制信息)。具体地,该模块根据状态感知和处理模块所输出的机器人当前状态,通过图4对应的方法,可以输出未来一段时间的行为决策,并传递给机器人控制模块。Regarding the robust decision-making module: the function of this module is to output upper-level behavioral decisions in the future based on the current robot status and the task being performed (such as when performing the target task on the target object introduced in the above embodiment). control information). Specifically, based on the current state of the robot output by the state sensing and processing module, this module can output behavioral decisions for a period of time in the future through the method corresponding to Figure 4, and pass them to the robot control module.
关于机器人控制模块:该模块通过控制机器人的关节,执行鲁棒性决策模块输出的行为,控制机器人进行运动。About the robot control module: This module controls the movement of the robot by controlling the joints of the robot and executing the behavior output by the robust decision-making module.
具体的,参照图6,图6为将本申请实施例中的模型训练方法应用于机器人控制仿真场景中的流程示意。机器人采用本申请实施例中的模型训练方法通过多任务框架和博理论优化理论,最终输出能够最大化机器人前进速度的行为决策,得到更多的奖励。下面详细介绍实施方法。Specifically, refer to FIG. 6 , which is a flowchart of applying the model training method in the embodiment of the present application to a robot control simulation scenario. The robot adopts the model training method in the embodiment of this application through the multi-task framework and gambling theory optimization theory, and finally outputs behavioral decisions that can maximize the forward speed of the robot and obtain more rewards. The implementation method is introduced in detail below.
S1.输入多任务学习的参数Φ=[φ1,φ2,...],初始化强化学习策略π,对每个任务i初始化对抗智能体策略μi,选择Φ中的第i个参数作为对抗智能体策略μi的动作空间参数构建多个任务,每个任务中对抗智能体可以对仿真机器人的身体施加一个干扰力。初始化纳什均衡分布可以为均匀分布。S1. Input the parameters of multi-task learning Φ=[φ 1 , φ 2 ,...], initialize the reinforcement learning strategy π, initialize the adversarial agent strategy μ i for each task i, and select the i-th parameter in Φ as The action space parameters of the adversarial agent strategy μ i construct multiple tasks. In each task, the adversarial agent can exert an interference force on the body of the simulated robot. The initial Nash equilibrium distribution can be a uniform distribution.
S2.根据Φ依次选择相应的对抗智能体作为当前的对抗任务。S2. Select the corresponding confrontation agent in sequence according to Φ as the current confrontation task.
S3.根据纳什均衡中对抗智能体的分布,抽样选取一个对抗智能体的历史策略作为当前对抗任务的对抗策略,并将该对抗策略部署至训练环境。S3. Based on the distribution of adversarial agents in Nash equilibrium, sample a historical strategy of adversarial agents. As an adversarial strategy for the current adversarial task, the adversarial strategy is deployed to the training environment.
S4.根据强化学习策略π和对抗智能体策略μi,t,在训练环境中控制机器人进行采样得到M个样本(s状态,apro,aadv,s′,r奖励),其中apro,aadv分别为强化学习策略的行为输出和对抗智能体的行为。S4. According to the reinforcement learning strategy π and the adversarial agent strategy μ i,t , control the robot to sample in the training environment to obtain M samples (s state, a pro , a adv , s′, r reward), where a pro , a adv are the behavioral output of the reinforcement learning strategy and the behavior of the adversarial agent respectively.
S5.对强化学习策略π进行更新,更新的目标函数为:
S5. Update the reinforcement learning strategy π, and the updated objective function is:
即最大化所获得的累计奖励,更新方法可以采取连续动作空间的强化学习算法,可选的,可以采取可信区域策略优化算法(trust region policy optimization,TRPO)。That is, to maximize the cumulative reward obtained, the update method can adopt the reinforcement learning algorithm of the continuous action space, and optionally, the trust region policy optimization algorithm (TRPO) can be adopted.
S6.根据纳什均衡中强化学习策略的历史分布,抽样选取一个强化学习智能体的历史策略作为当前对抗智能体策略需要干扰的强化学习策略,并将该强化学习策略部署至训练环境。S6. Based on the historical distribution of reinforcement learning strategies in Nash equilibrium, sample the historical strategy of a reinforcement learning agent A reinforcement learning strategy needs to be interfered with as the current adversarial agent strategy, and the reinforcement learning strategy is deployed to the training environment.
S7.根据强化学习策略πi,t和对抗智能体策略μi,在训练环境中控制机器人进行采样得到M个样本(s,apro,aadv,s′,r)。S7. According to the reinforcement learning strategy π i,t and the adversarial agent strategy μ i , control the robot to sample in the training environment to obtain M samples (s, a pro , a adv , s′, r).
S8.对对抗智能体策略μi进行更新,更新的目标函数为:
S8. Update the adversarial agent strategy μ i . The updated objective function is:
即最小化强化学习策略所获得的累计奖励,阻碍强化学习智能体达成目标,更新方法可以采取连续动作空间的强化学习算法,可选的,可以采取可信区域策略优化算法TRPO。That is, to minimize the cumulative reward obtained by the reinforcement learning strategy and prevent the reinforcement learning agent from achieving the goal, the update method can adopt the reinforcement learning algorithm of the continuous action space. Alternatively, the trusted region policy optimization algorithm TRPO can be used.
S9.每k步,针对每个任务,将强化学习策略和对抗智能体更新后的策略加入纳什均衡矩阵,通过遍 历测试新加入策略和已有历史策略的在训练环境中的表现,得到新加入策略的纳什均衡值矩阵,并根据值矩阵计算纳什均衡,得到强化学习和对抗智能体的纳什均衡分布。S9. Every k steps, for each task, add the reinforcement learning strategy and the updated strategy of the adversarial agent to the Nash equilibrium matrix, and pass it through Historically test the performance of newly added strategies and existing historical strategies in the training environment, obtain the Nash equilibrium value matrix of the newly added strategy, and calculate the Nash equilibrium based on the value matrix to obtain the Nash equilibrium distribution of reinforcement learning and adversarial agents.
判断当前任务是否结束,若未结束,则执行步骤S2,否则执行步骤S10。Determine whether the current task is over. If it is not over, execute step S2. Otherwise, execute step S10.
S10.将训练得到的强化学习策略部署至与训练环境有差异的测试环境中,测试鲁棒性。S10. Deploy the trained reinforcement learning strategy to a test environment that is different from the training environment to test the robustness.
上述介绍的实施例采用一种基于多任务学习和博弈论的鲁棒强化学习控制框架,通过改变对抗智能体的动作空间构建多个对抗任务,提高强化学习算法的鲁棒性。此外,引入了基于博弈论的优化框架,在每个任务的训练过程中根据历史策略表现,选择最合适的对抗策略,使得强化学习策略更加鲁棒。The above-described embodiment uses a robust reinforcement learning control framework based on multi-task learning and game theory to construct multiple adversarial tasks by changing the action space of the adversarial agent to improve the robustness of the reinforcement learning algorithm. In addition, an optimization framework based on game theory is introduced to select the most appropriate confrontation strategy based on historical strategy performance during the training process of each task, making the reinforcement learning strategy more robust.
应理解,本申请实施例中的博弈论优化框架包括但不限于策略空间回应求解器(policy-space response oracles,PSRO)等;对于强化学习模型的训练包括但不限于采样强化学习算法,比如可信空间策略优化算法(TRPO),临近策略优化算法(proximal policy optimization,PPO)等。It should be understood that the game theory optimization framework in the embodiments of this application includes but is not limited to policy-space response oracles (PSRO), etc.; the training of reinforcement learning models includes but is not limited to sampling reinforcement learning algorithms, such as Letter space policy optimization algorithm (TRPO), proximal policy optimization algorithm (proximal policy optimization, PPO), etc.
本申请提供了一种模型训练方法,所述方法包括:通过第一强化学习模型,处理第一数据,以得到第一处理结果;其中,所述第一数据指示目标物体的状态,所述第一处理结果用于作为在所述目标物体上执行目标任务时的控制信息;通过第一目标神经网络,处理所述第一数据,以得到第二处理结果;其中,所述第二处理结果用于作为执行所述目标任务时的干扰信息,所述第一目标神经网络为从多个第一神经网络中选择的,每个所述第一神经网络为对第一初始神经网络进行迭代训练的过程得到的一个迭代结果;根据所述第一处理结果和所述第二处理结果,执行所述目标任务,得到第三处理结果;根据所述第三处理结果,更新所述第一强化学习模型,以得到更新后的第一强化学习模型。在现有的实现中,可以训练一个用于输出干扰信息的对抗智能体,该干扰信息只针对于目标任务进行一种干扰,在本申请实施例中,一方面,可以训练多个用于输出干扰信息的对抗智能体,不同对抗智能体输出的干扰信息可以针对于目标任务进行不同类的干扰,另一方面,在训练对抗智能体时,不仅仅利用当前最新迭代得到的对抗智能体来输出针对于目标任务的干扰,还可以利用历史上对抗智能体的历史训练结果(历史迭代过程中得到的对抗智能体)来输出针对于目标任务的干扰,从而可以得到适配于不同的场景下针对于目标任务的更有效的干扰,从而提高模型的训练效果和泛化性。The present application provides a model training method, which method includes: processing first data through a first reinforcement learning model to obtain a first processing result; wherein the first data indicates the state of the target object, and the third A processing result is used as control information when performing a target task on the target object; the first data is processed through the first target neural network to obtain a second processing result; wherein the second processing result is represented by As interference information when performing the target task, the first target neural network is selected from a plurality of first neural networks, and each of the first neural networks is iteratively trained on the first initial neural network. An iteration result obtained by the process; according to the first processing result and the second processing result, the target task is executed to obtain a third processing result; according to the third processing result, the first reinforcement learning model is updated , to obtain the updated first reinforcement learning model. In the existing implementation, an adversarial agent for outputting interference information can be trained. The interference information only performs one kind of interference for the target task. In the embodiment of the present application, on the one hand, multiple adversarial agents for outputting interference information can be trained. Adversarial agents that interfere with information. The interference information output by different adversarial agents can interfere with different types of target tasks. On the other hand, when training adversarial agents, not only the adversarial agents obtained in the latest iteration are used to output For interference on the target task, the historical training results of historical adversarial agents (adversarial agents obtained during the historical iteration process) can also be used to output interference on the target task, so that the system can be adapted to different scenarios. More effective interference with the target task, thereby improving the training effect and generalization of the model.
参照图7,图7为本申请实施例提供的一种模型训练装置的结构示意,如图7所示,所述装置700,包括:Referring to Figure 7, Figure 7 is a schematic structural diagram of a model training device provided by an embodiment of the present application. As shown in Figure 7, the device 700 includes:
数据处理模块701,用于通过第一强化学习模型,处理第一数据,以得到第一处理结果;其中,所述第一数据指示目标物体的状态,所述第一处理结果用于作为在所述目标物体上执行目标任务时的控制信息;The data processing module 701 is used to process the first data through the first reinforcement learning model to obtain a first processing result; wherein the first data indicates the state of the target object, and the first processing result is used as the target object. Control information when performing target tasks on the target object;
通过第一目标神经网络,处理所述第一数据,以得到第二处理结果;其中,所述第二处理结果用于作为执行所述目标任务时的干扰信息,所述第一目标神经网络为从多个第一神经网络中选择的,每个所述第一神经网络为对第一初始神经网络进行迭代训练的过程得到的一个迭代结果;The first data is processed through a first target neural network to obtain a second processing result; wherein the second processing result is used as interference information when executing the target task, and the first target neural network is Selected from a plurality of first neural networks, each first neural network is an iterative result obtained from the process of iterative training of the first initial neural network;
根据所述第一处理结果和所述第二处理结果,执行所述目标任务,得到第三处理结果;According to the first processing result and the second processing result, execute the target task and obtain a third processing result;
其中,关于数据处理模块701的具体描述可以参照上述实施例中步骤401、步骤402以及步骤403的描述,这里不再赘述。For the specific description of the data processing module 701, reference may be made to the description of step 401, step 402, and step 403 in the above embodiment, which will not be described again here.
模型更新模块702,用于根据所述第三处理结果,更新所述第一强化学习模型,以得到更新后的第一强化学习模型。The model update module 702 is configured to update the first reinforcement learning model according to the third processing result to obtain an updated first reinforcement learning model.
其中,关于模型更新模块702的具体描述可以参照上述实施例中步骤404的描述,这里不再赘述。For a specific description of the model update module 702, reference may be made to the description of step 404 in the above embodiment, which will not be described again here.
在现有的实现中,可以训练一个用于输出干扰信息的对抗智能体,该干扰信息只针对于目标任务进行一种干扰,在本申请实施例中,一方面,可以训练多个用于输出干扰信息的对抗智能体,不同对抗智能体输出的干扰信息可以针对于目标任务进行不同类的干扰,另一方面,在训练对抗智能体时,不仅仅利用当前最新迭代得到的对抗智能体来输出针对于目标任务的干扰,还可以利用历史上对抗智能体的历史训练结果(历史迭代过程中得到的对抗智能体)来输出针对于目标任务的干扰,从而可以得到适配于不同的场景下针对于目标任务的更有效的干扰,从而提高模型的训练效果和泛化性。In the existing implementation, an adversarial agent for outputting interference information can be trained. The interference information only performs one kind of interference for the target task. In the embodiment of the present application, on the one hand, multiple adversarial agents for outputting interference information can be trained. Adversarial agents that interfere with information. The interference information output by different adversarial agents can interfere with different types of target tasks. On the other hand, when training adversarial agents, not only the adversarial agents obtained in the latest iteration are used to output For interference on the target task, the historical training results of historical adversarial agents (adversarial agents obtained during the historical iteration process) can also be used to output interference on the target task, so that the system can be adapted to different scenarios. More effective interference with the target task, thereby improving the training effect and generalization of the model.
在一种可能的实现中, In one possible implementation,
所述目标物体为机器人;所述目标任务为机器人的姿态操控,所述第一处理结果为机器人的姿态控制信息;或者,The target object is a robot; the target task is the attitude control of the robot, and the first processing result is the attitude control information of the robot; or,
所述目标物体为车辆;所述目标任务为车辆的自动驾驶,所述第一处理结果为车辆的驾驶控制信息。The target object is a vehicle; the target task is automatic driving of the vehicle; and the first processing result is the driving control information of the vehicle.
在一种可能的实现中,所述第一目标神经网络为基于所述多个第一神经网络中每个第一神经网络对应的第一选择概率,从多个第一神经网络中选择得到的。In a possible implementation, the first target neural network is selected from a plurality of first neural networks based on a first selection probability corresponding to each of the plurality of first neural networks. .
在一种可能的实现中,所述模型更新模块,具体用于:In a possible implementation, the model update module is specifically used to:
根据所述第三处理结果,得到所述目标任务对应的奖励值;According to the third processing result, the reward value corresponding to the target task is obtained;
根据所述奖励值,更新所述第一强化学习模型;According to the reward value, update the first reinforcement learning model;
所述模型更新模块,还用于:The model update module is also used to:
根据所述奖励值,更新所述第一目标神经网络对应的第一选择概率。According to the reward value, the first selection probability corresponding to the first target neural network is updated.
在一种可能的实现中,所述数据处理模块,还用于:In a possible implementation, the data processing module is also used to:
通过第二目标神经网络,处理所述第一数据,以得到第四处理结果;其中,所述第四处理结果用于作为执行所述目标任务时的干扰信息,所述第二目标神经网络为从多个第二神经网络中选择的,每个所述第二神经网络为对第二初始神经网络进行迭代训练的过程得到的一个迭代结果;所述第一初始神经网络和所述第二初始神经网络不同;The first data is processed through a second target neural network to obtain a fourth processing result; wherein the fourth processing result is used as interference information when executing the target task, and the second target neural network is Selected from a plurality of second neural networks, each second neural network is an iterative result obtained from the iterative training process of a second initial neural network; the first initial neural network and the second initial neural network are Neural networks are different;
所述数据处理模块,具体用于:The data processing module is specifically used for:
根据所述第一处理结果、所述第四处理结果和所述第二处理结果,执行所述目标任务,得到第三处理结果。According to the first processing result, the fourth processing result and the second processing result, the target task is executed to obtain a third processing result.
在一种可能的实现中,所述第二处理结果和所述第四处理结果的干扰类型不同;或者,In a possible implementation, the interference types of the second processing result and the fourth processing result are different; or,
所述第二处理结果和所述第四处理结果的干扰对象不同;或者,The interference objects of the second processing result and the fourth processing result are different; or,
所述第一目标神经网络用于根据所述第一数据,从第一数值范围内确定所述第二处理结果,所述第二目标神经网络用于根据所述第一数据,从第二数值范围内确定所述第四处理结果,所述第二数值范围和所述第一数值范围不同。The first target neural network is used to determine the second processing result from a first numerical range according to the first data, and the second target neural network is used to determine the second processing result from a second numerical value according to the first data. The fourth processing result is determined within a range, and the second numerical range is different from the first numerical range.
在一种可能的实现中,所述数据处理模块,还用于:In a possible implementation, the data processing module is also used to:
通过第二强化学习模型,处理第二数据,以得到第五处理结果;其中,所述第二强化学习模型为从包括所述更新后的第一强化学习模型在内的多个强化学习模型中选择的,每个所述强化学习模型为对初始强化学习模型进行迭代训练的过程得到的一个迭代结果;所述第二数据指示目标物体的状态,所述第五处理结果用于作为在所述目标物体上执行所述目标任务时的控制信息;Process the second data through the second reinforcement learning model to obtain a fifth processing result; wherein the second reinforcement learning model is selected from a plurality of reinforcement learning models including the updated first reinforcement learning model. Optionally, each of the reinforcement learning models is an iterative result obtained from the iterative training process of the initial reinforcement learning model; the second data indicates the state of the target object, and the fifth processing result is used as the Control information when performing the target task on the target object;
通过第三目标神经网络,处理所述第二数据,以得到第六处理结果;所述第三目标神经网络属于所述多个第一神经网络;所述第六处理结果用于作为执行所述目标任务时的干扰信息;The second data is processed through a third target neural network to obtain a sixth processing result; the third target neural network belongs to the plurality of first neural networks; the sixth processing result is used as the basis for executing the Interfering information during the target task;
根据所述第五处理结果和所述第六处理结果,执行所述目标任务,得到第七处理结果;According to the fifth processing result and the sixth processing result, execute the target task and obtain a seventh processing result;
所述模型更新模块,还用于:The model update module is also used to:
根据所述第七处理结果,更新所述第三目标神经网络,以得到更新后的第三目标神经网络。According to the seventh processing result, the third target neural network is updated to obtain an updated third target neural network.
在一种可能的实现中,所述第二强化学习模型为基于所述多个强化学习模型中每个强化学习模型对应的第二选择概率,从多个强化学习模型中选择得到的。In a possible implementation, the second reinforcement learning model is selected from multiple reinforcement learning models based on the second selection probability corresponding to each reinforcement learning model in the multiple reinforcement learning models.
接下来介绍本申请实施例提供的一种执行设备,请参阅图8,图8为本申请实施例提供的执行设备的一种结构示意图,执行设备800具体可以表现为手机、平板、笔记本电脑、智能穿戴设备等,此处不做限定。具体的,执行设备800包括:接收器801、发射器802、处理器803和存储器804(其中执行设备800中的处理器803的数量可以一个或多个,图8中以一个处理器为例),其中,处理器803可以包括应用处理器8031和通信处理器8032。在本申请的一些实施例中,接收器801、发射器802、处理器803和存储器804可通过总线或其它方式连接。Next, an execution device provided by an embodiment of the present application is introduced. Please refer to Figure 8. Figure 8 is a schematic structural diagram of an execution device provided by an embodiment of the present application. The execution device 800 can be embodied as a mobile phone, a tablet, a notebook computer, Smart wearable devices, etc. are not limited here. Specifically, the execution device 800 includes: a receiver 801, a transmitter 802, a processor 803 and a memory 804 (the number of processors 803 in the execution device 800 can be one or more, one processor is taken as an example in Figure 8) , wherein the processor 803 may include an application processor 8031 and a communication processor 8032. In some embodiments of the present application, the receiver 801, the transmitter 802, the processor 803, and the memory 804 may be connected through a bus or other means.
存储器804可以包括只读存储器和随机存取存储器,并向处理器803提供指令和数据。存储器804的一部分还可以包括非易失性随机存取存储器(non-volatile random access memory,NVRAM)。存储器804存储有处理器和操作指令、可执行模块或者数据结构,或者它们的子集,或者它们的扩展集,其中, 操作指令可包括各种操作指令,用于实现各种操作。Memory 804 may include read-only memory and random access memory and provides instructions and data to processor 803 . A portion of memory 804 may also include non-volatile random access memory (NVRAM). Memory 804 stores processor and operating instructions, executable modules or data structures, or subsets thereof, or extended sets thereof, where: The operation instructions may include various operation instructions for implementing various operations.
处理器803控制执行设备的操作。具体的应用中,执行设备的各个组件通过总线系统耦合在一起,其中总线系统除包括数据总线之外,还可以包括电源总线、控制总线和状态信号总线等。但是为了清楚说明起见,在图中将各种总线都称为总线系统。Processor 803 controls execution of operations of the device. In specific applications, various components of the execution device are coupled together through a bus system. In addition to the data bus, the bus system may also include a power bus, a control bus, a status signal bus, etc. However, for the sake of clarity, various buses are called bus systems in the figure.
上述本申请实施例揭示的方法可以应用于处理器803中,或者由处理器803实现。处理器803可以是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤可以通过处理器803中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器803可以是通用处理器、数字信号处理器(digital signal processing,DSP)、微处理器或微控制器,还可进一步包括专用集成电路(application specific integrated circuit,ASIC)、现场可编程门阵列(field-programmable gate array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。该处理器803可以实现或者执行本申请实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本申请实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器804,处理器803读取存储器804中的信息,结合其硬件完成上述方法的步骤。The methods disclosed in the above embodiments of the present application can be applied to the processor 803 or implemented by the processor 803. The processor 803 may be an integrated circuit chip with signal processing capabilities. During the implementation process, each step of the above method can be completed by instructions in the form of hardware integrated logic circuits or software in the processor 803 . The above-mentioned processor 803 can be a general processor, a digital signal processor (DSP), a microprocessor or a microcontroller, and can further include an application specific integrated circuit (ASIC), a field programmable Gate array (field-programmable gate array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The processor 803 can implement or execute the disclosed methods, steps and logical block diagrams in the embodiments of this application. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present application can be directly implemented by a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software module can be located in random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, registers and other mature storage media in this field. The storage medium is located in the memory 804. The processor 803 reads the information in the memory 804 and completes the steps of the above method in combination with its hardware.
接收器801可用于接收输入的数字或字符信息,以及产生与执行设备的相关设置以及功能控制有关的信号输入。发射器802可用于输出数字或字符信息;发射器802还可用于向磁盘组发送指令,以修改磁盘组中的数据。The receiver 801 may be used to receive input numeric or character information and generate signal inputs related to performing relevant settings and functional controls of the device. The transmitter 802 can be used to output numeric or character information; the transmitter 802 can also be used to send instructions to the disk group to modify data in the disk group.
本申请实施例中,在一种情况下,处理器803,用于执行通过图4对应实施例中的模型训练方法得到的模型的步骤。In the embodiment of the present application, in one case, the processor 803 is configured to execute the steps of the model obtained through the model training method in the corresponding embodiment of FIG. 4 .
本申请实施例还提供了一种服务器,请参阅图9,图9是本申请实施例提供的服务器一种结构示意图,具体的,服务器900由一个或多个服务器实现,服务器900可因配置或性能不同而产生比较大的差异,可以包括一个或一个以上中央处理器(central processing units,CPU)99(例如,一个或一个以上处理器)和存储器932,一个或一个以上存储应用程序942或数据944的存储介质930(例如一个或一个以上海量存储设备)。其中,存储器932和存储介质930可以是短暂存储或持久存储。存储在存储介质930的程序可以包括一个或一个以上模块(图示没标出),每个模块可以包括对服务器中的一系列指令操作。更进一步地,中央处理器99可以设置为与存储介质930通信,在服务器900上执行存储介质930中的一系列指令操作。The embodiment of the present application also provides a server. Please refer to Figure 9. Figure 9 is a schematic structural diagram of the server provided by the embodiment of the present application. Specifically, the server 900 is implemented by one or more servers. The server 900 can be configured or There is a relatively large difference due to different performance, which may include one or more central processing units (CPU) 99 (for example, one or more processors) and memory 932, and one or more storage applications 942 or data 944 storage medium 930 (eg, one or more mass storage devices). Among them, the memory 932 and the storage medium 930 may be short-term storage or persistent storage. The program stored in the storage medium 930 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the server. Furthermore, the central processor 99 may be configured to communicate with the storage medium 930 and execute a series of instruction operations in the storage medium 930 on the server 900 .
服务器900还可以包括一个或一个以上电源99,一个或一个以上有线或无线网络接口950,一个或一个以上输入输出接口958;或,一个或一个以上操作系统941,例如Windows ServerTM,Mac OS XTM,UnixTM,LinuxTM,FreeBSDTM等等。The server 900 may also include one or more power supplies 99, one or more wired or wireless network interfaces 950, one or more input and output interfaces 958; or, one or more operating systems 941, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM and so on.
本申请实施例中,中央处理器99,用于执行图4对应实施例中的模型训练方法的步骤。In this embodiment of the present application, the central processor 99 is used to execute the steps of the model training method in the corresponding embodiment of FIG. 4 .
本申请实施例中还提供一种包括计算机可读指令的计算机程序产品,当其在计算机上运行时,使得计算机执行如前述执行设备所执行的步骤,或者,使得计算机执行如前述训练设备所执行的步骤。An embodiment of the present application also provides a computer program product including computer readable instructions, which when run on a computer causes the computer to perform the steps performed by the foregoing execution device, or causes the computer to perform the steps performed by the foregoing training device. A step of.
本申请实施例中还提供一种计算机可读存储介质,该计算机可读存储介质中存储有用于进行信号处理的程序,当其在计算机上运行时,使得计算机执行如前述执行设备所执行的步骤,或者,使得计算机执行如前述训练设备所执行的步骤。Embodiments of the present application also provide a computer-readable storage medium. The computer-readable storage medium stores a program for performing signal processing. When the program is run on a computer, it causes the computer to perform the steps performed by the aforementioned execution device. , or, causing the computer to perform the steps performed by the aforementioned training device.
本申请实施例提供的执行设备、训练设备或终端设备具体可以为芯片,芯片包括:处理单元和通信单元,所述处理单元例如可以是处理器,所述通信单元例如可以是输入/输出接口、管脚或电路等。该处理单元可执行存储单元存储的计算机执行指令,以使执行设备内的芯片执行上述实施例描述的模型训练方法,或者,以使训练设备内的芯片执行上述实施例中与模型训练相关的步骤。可选地,所述存储单元为所述芯片内的存储单元,如寄存器、缓存等,所述存储单元还可以是所述无线接入设备端内的位于所述芯片外部的存储单元,如只读存储器(read-only memory,ROM)或可存储静态信息和指令的其他类型的静态存储设备,随机存取存储器(random access memory,RAM)等。The execution device, training device or terminal device provided by the embodiment of the present application may specifically be a chip. The chip includes: a processing unit and a communication unit. The processing unit may be, for example, a processor. The communication unit may be, for example, an input/output interface. Pins or circuits, etc. The processing unit can execute the computer execution instructions stored in the storage unit, so that the chip in the execution device executes the model training method described in the above embodiment, or so that the chip in the training device executes the steps related to model training in the above embodiment. . Optionally, the storage unit is a storage unit within the chip, such as a register, cache, etc. The storage unit may also be a storage unit located outside the chip in the wireless access device, such as Read-only memory (ROM) or other types of static storage devices that can store static information and instructions, random access memory (random access memory, RAM), etc.
具体的,请参阅图10,图10为本申请实施例提供的芯片的一种结构示意图,所述芯片可以表现为 神经网络处理器NPU 1000,NPU 1000作为协处理器挂载到主CPU(Host CPU)上,由Host CPU分配任务。NPU的核心部分为运算电路1003,通过控制器1004控制运算电路1003提取存储器中的矩阵数据并进行乘法运算。Specifically, please refer to Figure 10. Figure 10 is a schematic structural diagram of a chip provided by an embodiment of the present application. The chip can be expressed as: Neural network processor NPU 1000, NPU 1000 is mounted on the main CPU (Host CPU) as a co-processor, and the Host CPU allocates tasks. The core part of the NPU is the arithmetic circuit 1003. The arithmetic circuit 1003 is controlled by the controller 1004 to extract the matrix data in the memory and perform multiplication operations.
在一些实现中,运算电路1003内部包括多个处理单元(Process Engine,PE)。在一些实现中,运算电路1003是二维脉动阵列。运算电路1003还可以是一维脉动阵列或者能够执行例如乘法和加法这样的数学运算的其它电子线路。在一些实现中,运算电路1003是通用的矩阵处理器。In some implementations, the computing circuit 1003 includes multiple processing units (Process Engine, PE). In some implementations, arithmetic circuit 1003 is a two-dimensional systolic array. The arithmetic circuit 1003 may also be a one-dimensional systolic array or other electronic circuit capable of performing mathematical operations such as multiplication and addition. In some implementations, arithmetic circuit 1003 is a general-purpose matrix processor.
举例来说,假设有输入矩阵A,权重矩阵B,输出矩阵C。运算电路从权重存储器1002中取矩阵B相应的数据,并缓存在运算电路中每一个PE上。运算电路从输入存储器1001中取矩阵A数据与矩阵B进行矩阵运算,得到的矩阵的部分结果或最终结果,保存在累加器(accumulator)1008中。For example, assume there is an input matrix A, a weight matrix B, and an output matrix C. The arithmetic circuit obtains the corresponding data of matrix B from the weight memory 1002 and caches it on each PE in the arithmetic circuit. The operation circuit takes matrix A data and matrix B from the input memory 1001 to perform matrix operations, and the partial result or final result of the obtained matrix is stored in an accumulator (accumulator) 1008 .
统一存储器1006用于存放输入数据以及输出数据。权重数据直接通过存储单元访问控制器(Direct Memory Access Controller,DMAC)1005,DMAC被搬运到权重存储器1002中。输入数据也通过DMAC被搬运到统一存储器1006中。The unified memory 1006 is used to store input data and output data. The weight data directly passes through the storage unit access controller (Direct Memory Access Controller, DMAC) 1005, and the DMAC is transferred to the weight memory 1002. Input data is also transferred to unified memory 1006 via DMAC.
BIU为Bus Interface Unit即,总线接口单元1010,用于AXI总线与DMAC和取指存储器(Instruction Fetch Buffer,IFB)1009的交互。BIU is the Bus Interface Unit, that is, the bus interface unit 1010, which is used for the interaction between the AXI bus and the DMAC and the Instruction Fetch Buffer (IFB) 1009.
总线接口单元1010(Bus Interface Unit,简称BIU),用于取指存储器1009从外部存储器获取指令,还用于存储单元访问控制器1005从外部存储器获取输入矩阵A或者权重矩阵B的原数据。The bus interface unit 1010 (Bus Interface Unit, BIU for short) is used to fetch the memory 1009 to obtain instructions from the external memory, and is also used for the storage unit access controller 1005 to obtain the original data of the input matrix A or the weight matrix B from the external memory.
DMAC主要用于将外部存储器DDR中的输入数据搬运到统一存储器1006或将权重数据搬运到权重存储器1002中或将输入数据数据搬运到输入存储器1001中。DMAC is mainly used to transfer the input data in the external memory DDR to the unified memory 1006 or the weight data to the weight memory 1002 or the input data to the input memory 1001 .
向量计算单元1007包括多个运算处理单元,在需要的情况下,对运算电路的输出做进一步处理,如向量乘,向量加,指数运算,对数运算,大小比较等等。主要用于神经网络中非卷积/全连接层网络计算,如Batch Normalization(批归一化),像素级求和,对特征平面进行上采样等。The vector calculation unit 1007 includes multiple arithmetic processing units, and if necessary, further processes the output of the arithmetic circuit, such as vector multiplication, vector addition, exponential operation, logarithmic operation, size comparison, etc. Mainly used for non-convolutional/fully connected layer network calculations in neural networks, such as Batch Normalization, pixel-level summation, upsampling of feature planes, etc.
在一些实现中,向量计算单元1007能将经处理的输出的向量存储到统一存储器1006。例如,向量计算单元1007可以将线性函数;或,非线性函数应用到运算电路1003的输出,例如对卷积层提取的特征平面进行线性插值,再例如累加值的向量,用以生成激活值。在一些实现中,向量计算单元1007生成归一化的值、像素级求和的值,或二者均有。在一些实现中,处理过的输出的向量能够用作到运算电路1003的激活输入,例如用于在神经网络中的后续层中的使用。In some implementations, vector calculation unit 1007 can store the processed output vectors to unified memory 1006 . For example, the vector calculation unit 1007 can apply a linear function; or a nonlinear function to the output of the operation circuit 1003, such as linear interpolation on the feature plane extracted by the convolution layer, or a vector of accumulated values, to generate an activation value. In some implementations, vector calculation unit 1007 generates normalized values, pixel-wise summed values, or both. In some implementations, the processed output vector can be used as an activation input to the arithmetic circuit 1003, such as for use in a subsequent layer in a neural network.
控制器1004连接的取指存储器(instruction fetch buffer)1009,用于存储控制器1004使用的指令;The instruction fetch buffer 1009 connected to the controller 1004 is used to store instructions used by the controller 1004;
统一存储器1006,输入存储器1001,权重存储器1002以及取指存储器1009均为On-Chip存储器。外部存储器私有于该NPU硬件架构。The unified memory 1006, the input memory 1001, the weight memory 1002 and the fetch memory 1009 are all On-Chip memories. External memory is private to the NPU hardware architecture.
其中,上述任一处提到的处理器,可以是一个通用中央处理器,微处理器,ASIC,或一个或多个用于控制上述程序执行的集成电路。The processor mentioned in any of the above places can be a general central processing unit, a microprocessor, an ASIC, or one or more integrated circuits used to control the execution of the above programs.
另外需说明的是,以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。另外,本申请提供的装置实施例附图中,模块之间的连接关系表示它们之间具有通信连接,具体可以实现为一条或多条通信总线或信号线。In addition, it should be noted that the device embodiments described above are only illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physically separate. The physical unit can be located in one place, or it can be distributed across multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. In addition, in the drawings of the device embodiments provided in this application, the connection relationship between modules indicates that there are communication connections between them, which can be specifically implemented as one or more communication buses or signal lines.
通过以上的实施方式的描述,所属领域的技术人员可以清楚地了解到本申请可借助软件加必需的通用硬件的方式来实现,当然也可以通过专用硬件包括专用集成电路、专用CPU、专用存储器、专用元器件等来实现。一般情况下,凡由计算机程序完成的功能都可以很容易地用相应的硬件来实现,而且,用来实现同一功能的具体硬件结构也可以是多种多样的,例如模拟电路、数字电路或专用电路等。但是,对本申请而言更多情况下软件程序实现是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在可读取的存储介质中,如计算机的软盘、U盘、移动硬盘、ROM、RAM、磁碟或者光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,训练设备,或者网络设备等)执行本申请各个实施例所述的方法。 Through the above description of the embodiments, those skilled in the art can clearly understand that the present application can be implemented by software plus necessary general hardware. Of course, it can also be implemented by dedicated hardware including dedicated integrated circuits, dedicated CPUs, dedicated memories, Special components, etc. to achieve. In general, all functions performed by computer programs can be easily implemented with corresponding hardware. Moreover, the specific hardware structures used to implement the same function can also be diverse, such as analog circuits, digital circuits or special-purpose circuits. circuit etc. However, for this application, software program implementation is a better implementation in most cases. Based on this understanding, the technical solution of the present application can be embodied in the form of a software product in essence or that contributes to the existing technology. The computer software product is stored in a readable storage medium, such as a computer floppy disk. , U disk, mobile hard disk, ROM, RAM, magnetic disk or optical disk, etc., including several instructions to cause a computer device (which can be a personal computer, training device, or network device, etc.) to execute the steps described in various embodiments of this application. method.
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it may be implemented in whole or in part in the form of a computer program product.
所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、训练设备或数据中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、训练设备或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存储的任何可用介质或者是包含一个或多个可用介质集成的训练设备、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘(Solid State Disk,SSD))等。 The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions described in the embodiments of the present application are generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in or transmitted from one computer-readable storage medium to another, for example, the computer instructions may be transferred from a website, computer, training device, or data The center transmits to another website site, computer, training equipment or data center through wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store, or a data storage device such as a training device or a data center integrated with one or more available media. The available media may be magnetic media (eg, floppy disk, hard disk, magnetic tape), optical media (eg, DVD), or semiconductor media (eg, solid state disk (Solid State Disk, SSD)), etc.

Claims (21)

  1. 一种模型训练方法,其特征在于,所述方法包括:A model training method, characterized in that the method includes:
    通过第一强化学习模型,处理第一数据,以得到第一处理结果;其中,所述第一数据指示目标物体的状态,所述第一处理结果用于作为在所述目标物体上执行目标任务时的控制信息;Through the first reinforcement learning model, the first data is processed to obtain a first processing result; wherein the first data indicates the state of the target object, and the first processing result is used as a basis for executing the target task on the target object. time control information;
    通过第一目标神经网络,处理所述第一数据,以得到第二处理结果;其中,所述第二处理结果用于作为执行所述目标任务时的干扰信息,所述第一目标神经网络为从多个第一神经网络中选择的,每个所述第一神经网络为对第一初始神经网络进行迭代训练的过程得到的一个迭代结果;The first data is processed through a first target neural network to obtain a second processing result; wherein the second processing result is used as interference information when executing the target task, and the first target neural network is Selected from a plurality of first neural networks, each first neural network is an iterative result obtained from the process of iterative training of the first initial neural network;
    根据所述第一处理结果和所述第二处理结果,执行所述目标任务,得到第三处理结果;According to the first processing result and the second processing result, execute the target task and obtain a third processing result;
    根据所述第三处理结果,更新所述第一强化学习模型,以得到更新后的第一强化学习模型。According to the third processing result, the first reinforcement learning model is updated to obtain an updated first reinforcement learning model.
  2. 根据权利要求1所述的方法,其特征在于,The method according to claim 1, characterized in that:
    所述目标物体为机器人;所述目标任务为机器人的姿态操控,所述第一处理结果为机器人的姿态控制信息;或者,The target object is a robot; the target task is the attitude control of the robot, and the first processing result is the attitude control information of the robot; or,
    所述目标物体为车辆;所述目标任务为车辆的自动驾驶,所述第一处理结果为车辆的驾驶控制信息。The target object is a vehicle; the target task is automatic driving of the vehicle; and the first processing result is the driving control information of the vehicle.
  3. 根据权利要求1或2所述的方法,其特征在于,The method according to claim 1 or 2, characterized in that,
    所述第一目标神经网络为基于所述多个第一神经网络中每个第一神经网络对应的第一选择概率,从多个第一神经网络中选择得到的。The first target neural network is selected from a plurality of first neural networks based on a first selection probability corresponding to each first neural network in the plurality of first neural networks.
  4. 根据权利要求3所述的方法,其特征在于,每个第一神经网络处理数据得到的处理结果用于作为执行所述目标任务时的干扰,且所述第一选择概率与对应的第一神经网络输出的处理结果对所述目标任务的干扰程度正相关。The method according to claim 3, characterized in that the processing result obtained by each first neural network processing data is used as interference when executing the target task, and the first selection probability is consistent with the corresponding first neural network. The degree of interference of the processing results output by the network to the target task is positively related.
  5. 根据权利要求3或4所述的方法,其特征在于,所述根据所述第三处理结果,更新所述第一强化学习模型,包括:The method according to claim 3 or 4, characterized in that, updating the first reinforcement learning model according to the third processing result includes:
    根据所述第三处理结果,得到所述目标任务对应的奖励值;According to the third processing result, the reward value corresponding to the target task is obtained;
    根据所述奖励值,更新所述第一强化学习模型;According to the reward value, update the first reinforcement learning model;
    所述方法还包括:The method also includes:
    根据所述奖励值,更新所述第一目标神经网络对应的第一选择概率。According to the reward value, the first selection probability corresponding to the first target neural network is updated.
  6. 根据权利要求1至5任一所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 1 to 5, characterized in that the method further includes:
    通过第二目标神经网络,处理所述第一数据,以得到第四处理结果;其中,所述第四处理结果用于作为执行所述目标任务时的干扰信息,所述第二目标神经网络为从多个第二神经网络中选择的,每个所述第二神经网络为对第二初始神经网络进行迭代训练的过程得到的一个迭代结果;所述第一初始神经网络和所述第二初始神经网络不同;The first data is processed through a second target neural network to obtain a fourth processing result; wherein the fourth processing result is used as interference information when executing the target task, and the second target neural network is Selected from a plurality of second neural networks, each second neural network is an iterative result obtained from the iterative training process of a second initial neural network; the first initial neural network and the second initial neural network are Neural networks are different;
    所述根据所述第一处理结果和所述第二处理结果,执行所述目标任务,得到第三处理结果,包括:Executing the target task according to the first processing result and the second processing result to obtain a third processing result includes:
    根据所述第一处理结果、所述第四处理结果和所述第二处理结果,执行所述目标任务,得到第三处理结果。According to the first processing result, the fourth processing result and the second processing result, the target task is executed to obtain a third processing result.
  7. 根据权利要求6所述的方法,其特征在于,The method according to claim 6, characterized in that:
    所述第二处理结果和所述第四处理结果的干扰类型不同;或者,The interference types of the second processing result and the fourth processing result are different; or,
    所述第二处理结果和所述第四处理结果的干扰对象不同;或者,The interference objects of the second processing result and the fourth processing result are different; or,
    所述第一目标神经网络用于根据所述第一数据,从第一数值范围内确定所述第二处理结果,所述第二目标神经网络用于根据所述第一数据,从第二数值范围内确定所述第四处理结果,所述第二数值范围和所述第一数值范围不同。 The first target neural network is used to determine the second processing result from a first numerical range according to the first data, and the second target neural network is used to determine the second processing result from a second numerical value according to the first data. The fourth processing result is determined within a range, and the second numerical range is different from the first numerical range.
  8. 根据权利要求1至7任一所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 1 to 7, characterized in that the method further includes:
    通过第二强化学习模型,处理第二数据,以得到第五处理结果;其中,所述第二强化学习模型为从包括所述更新后的第一强化学习模型在内的多个强化学习模型中选择的,每个所述强化学习模型为对初始强化学习模型进行迭代训练的过程得到的一个迭代结果;所述第二数据指示目标物体的状态,所述第五处理结果用于作为在所述目标物体上执行所述目标任务时的控制信息;Process the second data through the second reinforcement learning model to obtain a fifth processing result; wherein the second reinforcement learning model is selected from a plurality of reinforcement learning models including the updated first reinforcement learning model. Optionally, each of the reinforcement learning models is an iterative result obtained from the iterative training process of the initial reinforcement learning model; the second data indicates the state of the target object, and the fifth processing result is used as the Control information when performing the target task on the target object;
    通过第三目标神经网络,处理所述第二数据,以得到第六处理结果;所述第三目标神经网络属于所述多个第一神经网络;所述第六处理结果用于作为执行所述目标任务时的干扰信息;The second data is processed through a third target neural network to obtain a sixth processing result; the third target neural network belongs to the plurality of first neural networks; the sixth processing result is used as the basis for executing the Interfering information during the target task;
    根据所述第五处理结果和所述第六处理结果,执行所述目标任务,得到第七处理结果;According to the fifth processing result and the sixth processing result, execute the target task and obtain a seventh processing result;
    根据所述第七处理结果,更新所述第三目标神经网络,以得到更新后的第三目标神经网络。According to the seventh processing result, the third target neural network is updated to obtain an updated third target neural network.
  9. 根据权利要求8所述的方法,其特征在于,所述第二强化学习模型为基于所述多个强化学习模型中每个强化学习模型对应的第二选择概率,从多个强化学习模型中选择得到的。The method of claim 8, wherein the second reinforcement learning model is selected from a plurality of reinforcement learning models based on the second selection probability corresponding to each reinforcement learning model in the plurality of reinforcement learning models. owned.
  10. 一种模型训练装置,其特征在于,所述装置包括:A model training device, characterized in that the device includes:
    数据处理模块,用于通过第一强化学习模型,处理第一数据,以得到第一处理结果;其中,所述第一数据指示目标物体的状态,所述第一处理结果用于作为在所述目标物体上执行目标任务时的控制信息;The data processing module is used to process the first data through the first reinforcement learning model to obtain the first processing result; wherein the first data indicates the state of the target object, and the first processing result is used as the first processing result in the Control information when performing target tasks on the target object;
    通过第一目标神经网络,处理所述第一数据,以得到第二处理结果;其中,所述第二处理结果用于作为执行所述目标任务时的干扰信息,所述第一目标神经网络为从多个第一神经网络中选择的,每个所述第一神经网络为对第一初始神经网络进行迭代训练的过程得到的一个迭代结果;The first data is processed through a first target neural network to obtain a second processing result; wherein the second processing result is used as interference information when executing the target task, and the first target neural network is Selected from a plurality of first neural networks, each first neural network is an iterative result obtained from the process of iterative training of the first initial neural network;
    根据所述第一处理结果和所述第二处理结果,执行所述目标任务,得到第三处理结果;According to the first processing result and the second processing result, execute the target task and obtain a third processing result;
    模型更新模块,用于根据所述第三处理结果,更新所述第一强化学习模型,以得到更新后的第一强化学习模型。A model update module, configured to update the first reinforcement learning model according to the third processing result to obtain an updated first reinforcement learning model.
  11. 根据权利要求10所述的装置,其特征在于,The device according to claim 10, characterized in that:
    所述目标物体为机器人;所述目标任务为机器人的姿态操控,所述第一处理结果为机器人的姿态控制信息;或者,The target object is a robot; the target task is the attitude control of the robot, and the first processing result is the attitude control information of the robot; or,
    所述目标物体为车辆;所述目标任务为车辆的自动驾驶,所述第一处理结果为车辆的驾驶控制信息。The target object is a vehicle; the target task is automatic driving of the vehicle; and the first processing result is the driving control information of the vehicle.
  12. 根据权利要求10或11所述的装置,其特征在于,The device according to claim 10 or 11, characterized in that,
    所述第一目标神经网络为基于所述多个第一神经网络中每个第一神经网络对应的第一选择概率,从多个第一神经网络中选择得到的。The first target neural network is selected from a plurality of first neural networks based on a first selection probability corresponding to each first neural network in the plurality of first neural networks.
  13. 根据权利要求12所述的装置,其特征在于,每个第一神经网络处理数据得到的处理结果用于作为执行所述目标任务时的干扰,且所述第一选择概率与对应的第一神经网络输出的处理结果对所述目标任务的干扰程度正相关。The device according to claim 12, characterized in that the processing result obtained by each first neural network processing data is used as interference when executing the target task, and the first selection probability is consistent with the corresponding first neural network. The degree of interference of the processing results output by the network to the target task is positively related.
  14. 根据权利要求12或13所述的装置,其特征在于,所述模型更新模块,具体用于:The device according to claim 12 or 13, characterized in that the model update module is specifically used for:
    根据所述第三处理结果,得到所述目标任务对应的奖励值;According to the third processing result, the reward value corresponding to the target task is obtained;
    根据所述奖励值,更新所述第一强化学习模型;According to the reward value, update the first reinforcement learning model;
    所述模型更新模块,还用于:The model update module is also used to:
    根据所述奖励值,更新所述第一目标神经网络对应的第一选择概率。According to the reward value, the first selection probability corresponding to the first target neural network is updated.
  15. 根据权利要求10至14任一所述的装置,其特征在于,所述数据处理模块,还用于:The device according to any one of claims 10 to 14, characterized in that the data processing module is also used to:
    通过第二目标神经网络,处理所述第一数据,以得到第四处理结果;其中,所述第四处理结果用于作为执行所述目标任务时的干扰信息,所述第二目标神经网络为从多个第二神经网络中选择的,每个所 述第二神经网络为对第二初始神经网络进行迭代训练的过程得到的一个迭代结果;所述第一初始神经网络和所述第二初始神经网络不同;The first data is processed through a second target neural network to obtain a fourth processing result; wherein the fourth processing result is used as interference information when executing the target task, and the second target neural network is selected from a plurality of second neural networks, each The second neural network is an iterative result obtained from the iterative training process of the second initial neural network; the first initial neural network and the second initial neural network are different;
    所述数据处理模块,具体用于:The data processing module is specifically used for:
    根据所述第一处理结果、所述第四处理结果和所述第二处理结果,执行所述目标任务,得到第三处理结果。According to the first processing result, the fourth processing result and the second processing result, the target task is executed to obtain a third processing result.
  16. 根据权利要求15所述的装置,其特征在于,The device according to claim 15, characterized in that:
    所述第二处理结果和所述第四处理结果的干扰类型不同;或者,The interference types of the second processing result and the fourth processing result are different; or,
    所述第二处理结果和所述第四处理结果的干扰对象不同;或者,The interference objects of the second processing result and the fourth processing result are different; or,
    所述第一目标神经网络用于根据所述第一数据,从第一数值范围内确定所述第二处理结果,所述第二目标神经网络用于根据所述第一数据,从第二数值范围内确定所述第四处理结果,所述第二数值范围和所述第一数值范围不同。The first target neural network is used to determine the second processing result from a first numerical range according to the first data, and the second target neural network is used to determine the second processing result from a second numerical value according to the first data. The fourth processing result is determined within a range, and the second numerical range is different from the first numerical range.
  17. 根据权利要求10至16任一所述的装置,其特征在于,所述数据处理模块,还用于:The device according to any one of claims 10 to 16, characterized in that the data processing module is also used to:
    通过第二强化学习模型,处理第二数据,以得到第五处理结果;其中,所述第二强化学习模型为从包括所述更新后的第一强化学习模型在内的多个强化学习模型中选择的,每个所述强化学习模型为对初始强化学习模型进行迭代训练的过程得到的一个迭代结果;所述第二数据指示目标物体的状态,所述第五处理结果用于作为在所述目标物体上执行所述目标任务时的控制信息;Process the second data through the second reinforcement learning model to obtain a fifth processing result; wherein the second reinforcement learning model is selected from a plurality of reinforcement learning models including the updated first reinforcement learning model. Optionally, each of the reinforcement learning models is an iterative result obtained from the iterative training process of the initial reinforcement learning model; the second data indicates the state of the target object, and the fifth processing result is used as the Control information when performing the target task on the target object;
    通过第三目标神经网络,处理所述第二数据,以得到第六处理结果;所述第三目标神经网络属于所述多个第一神经网络;所述第六处理结果用于作为执行所述目标任务时的干扰信息;The second data is processed through a third target neural network to obtain a sixth processing result; the third target neural network belongs to the plurality of first neural networks; the sixth processing result is used as the basis for executing the Interfering information during the target task;
    根据所述第五处理结果和所述第六处理结果,执行所述目标任务,得到第七处理结果;According to the fifth processing result and the sixth processing result, execute the target task and obtain a seventh processing result;
    所述模型更新模块,还用于:The model update module is also used to:
    根据所述第七处理结果,更新所述第三目标神经网络,以得到更新后的第三目标神经网络。According to the seventh processing result, the third target neural network is updated to obtain an updated third target neural network.
  18. 根据权利要求17所述的装置,其特征在于,所述第二强化学习模型为基于所述多个强化学习模型中每个强化学习模型对应的第二选择概率,从多个强化学习模型中选择得到的。The device according to claim 17, wherein the second reinforcement learning model is selected from a plurality of reinforcement learning models based on the second selection probability corresponding to each reinforcement learning model in the plurality of reinforcement learning models. owned.
  19. 一种模型训练装置,其特征在于,所述装置包括存储器和处理器;所述存储器存储有代码,所述处理器被配置为获取所述代码,并执行如权利要求1至9任一所述的方法。A model training device, characterized in that the device includes a memory and a processor; the memory stores code, and the processor is configured to obtain the code and execute as described in any one of claims 1 to 9 Methods.
  20. 一种计算机可读存储介质,其特征在于,包括计算机可读指令,当所述计算机可读指令在计算机设备上运行时,使得所述计算机设备执行权利要求1至9任一项所述的方法。A computer-readable storage medium, characterized by comprising computer-readable instructions that, when run on a computer device, cause the computer device to execute the method described in any one of claims 1 to 9 .
  21. 一种计算机程序产品,其特征在于,包括计算机可读指令,当所述计算机可读指令在计算机设备上运行时,使得所述计算机设备执行如权利要求1至9任一所述的方法。 A computer program product, characterized in that it includes computer-readable instructions that, when run on a computer device, cause the computer device to execute the method according to any one of claims 1 to 9.
PCT/CN2023/101527 2022-06-21 2023-06-20 Model training method and related device WO2023246819A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210705971.0 2022-06-21
CN202210705971.0A CN115293227A (en) 2022-06-21 2022-06-21 Model training method and related equipment

Publications (1)

Publication Number Publication Date
WO2023246819A1 true WO2023246819A1 (en) 2023-12-28

Family

ID=83821246

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/101527 WO2023246819A1 (en) 2022-06-21 2023-06-20 Model training method and related device

Country Status (2)

Country Link
CN (1) CN115293227A (en)
WO (1) WO2023246819A1 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115293227A (en) * 2022-06-21 2022-11-04 华为技术有限公司 Model training method and related equipment
CN116330290B (en) * 2023-04-10 2023-08-18 大连理工大学 Multi-agent deep reinforcement learning-based five-finger smart robot control method
CN116996403B (en) * 2023-09-26 2023-12-15 深圳市乙辰科技股份有限公司 Network traffic diagnosis method and system applying AI model

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6119112A (en) * 1997-11-19 2000-09-12 International Business Machines Corporation Optimum cessation of training in neural networks
CN113011575A (en) * 2019-12-19 2021-06-22 华为技术有限公司 Neural network model updating method, image processing method and device
CN113919482A (en) * 2021-09-22 2022-01-11 上海浦东发展银行股份有限公司 Intelligent agent training method and device, computer equipment and storage medium
CN113988196A (en) * 2021-11-01 2022-01-28 乐聚(深圳)机器人技术有限公司 Robot moving method, device, equipment and storage medium
CN114565092A (en) * 2020-11-13 2022-05-31 华为技术有限公司 Neural network structure determining method and device
CN115293227A (en) * 2022-06-21 2022-11-04 华为技术有限公司 Model training method and related equipment

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6119112A (en) * 1997-11-19 2000-09-12 International Business Machines Corporation Optimum cessation of training in neural networks
CN113011575A (en) * 2019-12-19 2021-06-22 华为技术有限公司 Neural network model updating method, image processing method and device
CN114565092A (en) * 2020-11-13 2022-05-31 华为技术有限公司 Neural network structure determining method and device
CN113919482A (en) * 2021-09-22 2022-01-11 上海浦东发展银行股份有限公司 Intelligent agent training method and device, computer equipment and storage medium
CN113988196A (en) * 2021-11-01 2022-01-28 乐聚(深圳)机器人技术有限公司 Robot moving method, device, equipment and storage medium
CN115293227A (en) * 2022-06-21 2022-11-04 华为技术有限公司 Model training method and related equipment

Also Published As

Publication number Publication date
CN115293227A (en) 2022-11-04

Similar Documents

Publication Publication Date Title
WO2023246819A1 (en) Model training method and related device
CN112651511B (en) Model training method, data processing method and device
WO2022022274A1 (en) Model training method and apparatus
WO2019228358A1 (en) Deep neural network training method and apparatus
WO2022042713A1 (en) Deep learning training method and apparatus for use in computing device
WO2022068623A1 (en) Model training method and related device
CN113065636A (en) Pruning processing method, data processing method and equipment for convolutional neural network
CN114997412A (en) Recommendation method, training method and device
WO2023274052A1 (en) Image classification method and related device thereof
WO2023231961A1 (en) Multi-agent reinforcement learning method and related device
CN111738403A (en) Neural network optimization method and related equipment
WO2023072175A1 (en) Point cloud data processing method, neural network training method, and related device
WO2023185925A1 (en) Data processing method and related apparatus
CN113065633A (en) Model training method and associated equipment
CN113627163A (en) Attention model, feature extraction method and related device
CN115238909A (en) Data value evaluation method based on federal learning and related equipment thereof
CN114169393A (en) Image classification method and related equipment thereof
WO2024120504A1 (en) Data processing method and related device
WO2024017282A1 (en) Data processing method and device
WO2023246735A1 (en) Item recommendation method and related device therefor
WO2023197857A1 (en) Model partitioning method and related device thereof
WO2023197910A1 (en) User behavior prediction method and related device thereof
WO2023045949A1 (en) Model training method and related device
CN115795025A (en) Abstract generation method and related equipment thereof
CN115565104A (en) Action prediction method and related equipment thereof

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23826465

Country of ref document: EP

Kind code of ref document: A1