Automatic training method and system for robotic arm based on deep learning, and electronic equipment
Through the deep learning method, the main arm is used to remotely operate the slave arm for data collection and model training, and the model parameters are optimized to achieve efficient and automated training of the robotic arm, solving the problems of low training efficiency and high cost in the existing technology, and improving the grasping efficiency. Take accuracy and training efficiency.
Patent Information
- Application Number
- CN202410992872.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-24
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2044-07-24
AI Technical Summary
The existing automatic training efficiency of robotic arms is low, the results of previous training cannot be effectively utilized, the cost is high, and the control and conversion of the gripper do not meet the actual situation, resulting in difficulty in hardware deployment.
Through the deep learning method, the main arm is used to remotely operate the slave arm to collect data, generate training data sets and verification data sets, train the ACT robotic arm automatic training model, and perform model optimization and model parameters to achieve complete dual-arm and single-arm Automated training improves anti-regularization of gripper opening and closing and improves target grabbing accuracy.
It greatly reduces the training cost, improves the model performance and efficiency, increases the degree of intelligence and usability, solves the problem of being unable to continue to optimize the trained model in the existing technology, and significantly improves the target grabbing accuracy and training speed.
Smart Images

Figure CN118537682B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of automatic training of robotic arms based on deep learning, and in particular to an automatic training method and system for robotic arms based on deep learning, and electronic equipment. Background Art
[0002] In recent years, deep learning, as a machine learning method, simulates the neural network structure of the human brain to perform complex data processing and pattern recognition. Deep learning has made remarkable achievements in image recognition, speech recognition, and natural language processing, and has provided a theoretical basis and technical support for the intelligence of robotic arms. At present, the efficiency of automatic training of robotic arms is low. That is, in the existing technology, the number of training times is selected based on the user's guess, and when the number of training times is small and model optimization is required, the results of previous training cannot be used. The existing robotic arm training system can only train the interaction of both arms, which is costly. In addition, the correspondence, control, and conversion of the existing robotic arm training system for grasping and clamping do not conform to the actual situation. When the main arm is gripping, the grasping motion trajectory of the slave arm does not correspond to the gripping of the main arm, resulting in the inability to implement hardware deployment.
[0003] Therefore, the prior art needs to be further developed. Summary of the invention
[0004] The purpose of the present invention is to overcome the above-mentioned technical deficiencies and provide a deep learning-based automatic training method and system for a robotic arm, and an electronic device to solve the problems existing in the prior art.
[0005] To achieve the above technical objectives, according to a first aspect of the present invention, the present invention provides a method for automatic training of a robotic arm based on deep learning, comprising:
[0006] S100, using the master arm of the robot arm to remotely operate the slave arm to collect data, obtain first position information of the master arm and first object information of the slave arm, and divide the first position information of the master arm and the first object information of the slave arm into a training data set and a verification data set according to a first preset ratio;
[0007] S200, training an ACT robotic arm automatic training model using a training data set and a verification data set of the first position information of the master arm and the first object information of the slave arm;
[0008] S300, using the verification data set to optimize the trained ACT robotic arm automatic training model, optimize the model parameters, and output the optimized model parameter file.
[0009] Specifically, the method of using the master arm of the robot to remotely operate the slave arm to collect data and obtain the first position information of the master arm and the first object information of the slave arm includes:
[0010] collecting first position information of the master arm, and transmitting the first position information to the slave arm;
[0011] Acquire the models of the master arm and the slave arm of the robot arm input by the user, and perform a first preprocessing on the gripping opening and closing angle of the slave arm according to the models of the master arm and the slave arm of the robot arm input by the user;
[0012] Generate first object information of the slave arm, and write the first object information into an array with a length of a first preset length to complete data collection.
[0013] Specifically, the acquiring the models of the master arm and the slave arm of the robotic arm input by the user, and performing a first preprocessing on the gripping opening and closing angle of the slave arm according to the models of the master arm and the slave arm of the robotic arm input by the user, includes:
[0014] Obtain the models of the master arm and the slave arm of the robot arm input by the user, determine whether the models of the master arm and the slave arm are consistent, and determine whether to calculate the opening and closing ratio of the slave arm gripping clamp based on the master arm gripping clamp according to the determination result;
[0015] If the models of the master arm and the slave arm are the same, that is, the opening and closing ranges of the master arm and the slave arm are the same, the opening and closing ratio of the slave arm's gripper will not be calculated;
[0016] If the models of the master arm and the slave arm are inconsistent, that is, the opening and closing ranges of the master arm and the slave arm are inconsistent, the opening and closing ratio of the slave arm clamp is calculated according to the opening and closing angle of the master arm clamp according to the first preset formula.
[0017] Specifically, the first object information of the slave arm includes:
[0018] The position information of the slave arm, the speed information of the slave arm, the force information of the slave arm, and the image information of the camera;
[0019] The image information of the camera includes: image information of the slave arm and the target object that is captured frame by frame by a camera set at a preset position during the process of the slave arm grabbing the target object from a starting point, and can simultaneously capture the slave arm and the target object. The camera at the preset position includes at least one of the following: a first camera set at the front end of the slave arm, a second camera set at the front end of the slave arm, a third camera set at the edge of the chassis, and a fourth camera set in the middle of the bracket.
[0020] Specifically, the training of the ACT robotic arm automatic training model using the training data set and the verification data set of the first position information of the master arm and the first object information of the slave arm includes:
[0021] Inputting the training data set of the first position information of the master arm and the first object information of the slave arm into a preset network layer in batches for training, wherein the preset network layer includes a ResNet network layer and a Transformer network layer, wherein the ResNet network layer is used to identify the position of the target object through the image information of the camera in the training data set and the verification data set, and the Transformer network layer is used to predict the next position according to the forward propagation of the current position, thereby obtaining the predicted loss value;
[0022] Calculate the loss value of the preset network layer and input it into the optimizer for optimization, and determine the direction in which the parameter gradient of the ACT robotic arm automatic training model descends fastest;
[0023] The ACT robotic arm automatic training model performs back propagation according to the loss value and the parameter gradient of the model to optimize the parameters of the ACT robotic arm automatic training model.
[0024] Specifically, the training data set and the verification data set using the first position information of the master arm and the first object information of the slave arm to train the ACT robot arm automatic training model also include:
[0025] After each training, the verification data set of the first position information of the master arm and the first object information of the slave arm is input into the preset network layer of the previous training in batches to verify the model parameters, and the cyclic training is performed, and the total training round is set to the first preset round;
[0026] Record the loss value of the preset network layer, determine whether the loss value meets the first preset condition, and determine whether to end the training and output the model parameters based on the determination result.
[0027] Specifically, the determining whether the loss value satisfies the first preset condition, and determining whether to end the training and output the model parameters according to the determination result, includes:
[0028] If the loss value meets the first preset condition, the training is terminated and the parameters of the current ACT robot arm automatic training model are output;
[0029] If the loss value does not meet the first preset condition, continue training.
[0030] Specifically, the first preset condition is: after the second preset round of training, the loss values obtained in the next round of training are greater than or equal to the loss values that occurred during the second preset round of training.
[0031] Specifically, the validation data set is used to optimize the trained ACT robotic arm automatic training model, optimize the model parameters, and output the optimized model parameter file, including:
[0032] Set the parameters of the custom ACT robot arm automatic training model, input the verification data set into the preset network layer to verify the model parameters, and optimize the model parameters according to the output loss value;
[0033] The training is repeated based on the new model parameters until the loss value meets the first preset condition, that is, the model optimization is completed, and the optimized model parameter file is output.
[0034] According to a second aspect of the present invention, there is provided a deep learning-based automatic training system for a robotic arm, comprising:
[0035] An acquisition module: using the master arm of the robot arm to remotely operate the slave arm to collect data, acquiring first position information of the master arm and first object information of the slave arm, and dividing the first position information of the master arm and the first object information of the slave arm into a training data set and a verification data set according to a first preset ratio;
[0036] Control module: train the ACT robotic arm automatic training model using the training data set and verification data set of the first position information of the master arm and the first object information of the slave arm; or optimize the trained ACT robotic arm automatic training model using the verification data set, optimize the model parameters, and output the optimized model parameter file.
[0037] According to a third aspect of the present invention, there is provided an electronic device, comprising: a memory; and a processor, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the above-mentioned deep learning-based automatic training method for a robotic arm is implemented.
[0038] Beneficial effects:
[0039] The present invention obtains the first position information of the main arm and the first object information of the slave arm, and divides the first position information of the main arm and the first object information of the slave arm into a training data set and a verification data set according to a first preset ratio; the training data set and the verification data set of the first position information of the main arm and the first object information of the slave arm are used to train the ACT robotic arm automatic training model, which can realize the fully automated training of double-arm training and single-arm training, greatly reducing the cost; the verification data set is used to optimize the trained ACT robotic arm automatic training model, optimize the model parameters, and output the optimized model parameter file, which solves the problem that the prior art cannot use the trained model to continue to optimize the model, and greatly improves the performance of the model; the present invention increases the inverse regularization of the opening and closing of the slave arm gripper, greatly improves the accuracy of target grasping, greatly reduces the training time, further improves the efficiency of model training, and greatly improves the intelligence, usability and reliability of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 is a flowchart of a method for automatic training of a robotic arm based on deep learning provided in a specific embodiment of the present invention;
[0041] Figure 2 Schematic diagram of the system composition of the deep learning-based automatic training system for a robotic arm provided in a specific embodiment of the present invention;
[0042] Figure 3 It is a structural schematic diagram of an ACT robotic arm automatic training model provided in a specific embodiment of the present invention;
[0043] Figure 4 is a schematic diagram of forward propagation of an ACT robotic arm automatic training model provided in a specific embodiment of the present invention;
[0044] Figure 5 is a schematic diagram of the installation position of the robot arm camera provided in a specific embodiment of the present invention;
[0045] Figure 6 is a schematic diagram of an image captured by a first camera provided in a specific implementation manner of the present invention;
[0046] Figure 7 is a schematic diagram of an image captured by a second camera provided in a specific embodiment of the present invention;
[0047] Figure 8 is a schematic diagram of an image captured by a third camera provided in a specific embodiment of the present invention;
[0048] Fig. 9 It is a schematic diagram of an image captured by a fourth camera provided in a specific implementation manner of the present invention. DETAILED DESCRIPTION
[0049] In order to enable those skilled in the art to better understand the technical solution of the present invention, the technical solution of the present invention is clearly and completely described below in conjunction with the accompanying drawings of the present invention. Based on the embodiments in this application, other similar embodiments obtained by ordinary technicians in this field without making creative work should all fall within the scope of protection of this application. In addition, the directional words mentioned in the following embodiments, such as "up", "down", "left", "right", etc., are only reference to the directions of the accompanying drawings. Therefore, the directional words used are used to illustrate rather than limit the invention.
[0050] The present invention will be further described below in conjunction with the accompanying drawings and preferred embodiments.
[0051] Embodiment 1
[0052] See also Figure 1 , this embodiment provides a method for automatic training of a robotic arm based on deep learning, comprising:
[0053] S100, using the master arm of the robot arm to remotely operate the slave arm to collect data, obtain first position information of the master arm and first object information of the slave arm, and divide the first position information of the master arm and the first object information of the slave arm into a training data set and a verification data set according to a first preset ratio;
[0054] It should be noted here that the first preset ratio, the first preset length, the first preset round, and the second preset round are preset before step S100.
[0055] It can be understood that the present invention does not limit the specific values of the first preset ratio, the first preset length, the first preset round, and the second preset round, as long as the automatic training method of the robotic arm based on deep learning proposed by the present invention can be applied.
[0056] Preferably, the present invention sets the first preset ratio to 9:1, the present invention sets the first preset length to 14, the present invention sets the first preset round to 20,000 times, and the present invention sets the second preset round to 200. The above settings can further improve the performance of the model and the efficiency of model training, and greatly improve the accuracy and reliability of the prediction of the ACT robotic arm automatic training model of the present invention.
[0057] Specifically, the method of using the master arm of the robot to remotely operate the slave arm to collect data and obtain the first position information of the master arm and the first object information of the slave arm includes:
[0058] collecting first position information of the master arm, and transmitting the first position information to the slave arm;
[0059] Acquire the models of the master arm and the slave arm of the robot arm input by the user, and perform a first preprocessing on the gripping opening and closing angle of the slave arm according to the models of the master arm and the slave arm of the robot arm input by the user;
[0060] Generate first object information of the slave arm, and write the first object information into an array with a length of a first preset length to complete data collection.
[0061] Specifically, the acquiring the models of the master arm and the slave arm of the robotic arm input by the user, and performing a first preprocessing on the gripping opening and closing angle of the slave arm according to the models of the master arm and the slave arm of the robotic arm input by the user, includes:
[0062] Obtain the models of the master arm and the slave arm of the robot arm input by the user, determine whether the models of the master arm and the slave arm are consistent, and determine whether to calculate the opening and closing ratio of the slave arm gripping clamp based on the master arm gripping clamp according to the determination result;
[0063] If the models of the master arm and the slave arm are the same, that is, the opening and closing ranges of the master arm and the slave arm are the same, the opening and closing ratio of the slave arm's gripper will not be calculated;
[0064] If the models of the master arm and the slave arm are inconsistent, that is, the opening and closing ranges of the master arm and the slave arm are inconsistent, the opening and closing ratio of the slave arm clamp is calculated according to the opening and closing angle of the master arm clamp according to the first preset formula.
[0065] It can be understood that the opening and closing ranges of the master arm and the slave arm are determined to be consistent according to the models of the master arm and the slave arm. If they are inconsistent, it is necessary to calculate the opening and closing ratio of the slave arm according to the first preset formula based on the opening and closing angle of the master arm's clamp to achieve equal-proportional opening and closing. The calculation method is as follows:
[0066] Slave arm grip closure value = -0.6213;
[0067] Opening value from arm grip = 1.4910;
[0068] The opening and closing ratio of the slave arm grip is calculated according to the first preset formula:
[0069] Slave arm clamp = master arm clamp * (1.4910-(-0.6213))-0.6313;
[0070] By testing and adjusting the correspondence between the master and slave arms of the gripper as described above, complete correspondence between the master and slave arms is achieved, which enables the gripper to grasp the target with an accuracy of more than 90%, thereby greatly improving the success rate of the ACT robotic arm automatic training model of the present invention in automatically completing precise actions.
[0071] Specifically, the first object information of the slave arm includes:
[0072] Position information of the slave arm, speed information of the slave arm, force information of the slave arm, and image information of the camera;
[0073] The image information of the camera includes: image information of the slave arm and the target object 6 that is captured frame by frame by a camera set at a preset position during the process of the slave arm grabbing the target object 6 from the starting point, and can simultaneously capture the slave arm and the target object 6. The camera at the preset position includes at least one of the following: a first camera 9 set at the front end of the first slave arm 1, a second camera 8 set at the front end of the second slave arm 2, a third camera 5 set at the edge of the chassis 3, and a fourth camera 7 set in the middle of the bracket 4.
[0074] It should be further explained that when dual-arm training is performed, the position information, speed information, force information, and camera image information of the slave arm are respectively written into an array of length 14, which contains 14 floating-point numbers, of which 1-6 numbers store the left arm position information, the 7th number stores the left arm gripping position information, the 8th-13th numbers store the right arm position information, and the 14th number stores the right arm gripping position information, and then integrated into the hd5 file to complete the collection of dual-arm data sets. The hd5 file is a file format for storing and organizing large amounts of data; when single-arm training is performed, the position information, speed information, force information, and camera image information of the slave arm are respectively written into an array of length 7, and then the array is expanded to 14 bits, and the values of 8-14 are set to be equal to the values of 1-7, of which 1-6 numbers store the left arm position information, and the 7th number stores the left arm gripping position information, and then integrated into the hd5 file to complete the collection of the single-arm data set;
[0075] like Figure 5 As shown, when double-arm training is performed, the camera includes a first camera 9 set at the front end of the first slave arm 1, a second camera 8 set at the front end of the second slave arm 2, a third camera 5 set at the edge of the chassis 3 and a fourth camera 7 set in the middle of the bracket 4, a total of four cameras, the fourth camera 7 set in the middle of the bracket 4 and the third camera 5 set at the edge of the chassis 3 can be deleted according to actual user needs, when single-arm training is performed, the camera includes a camera set at the edge of the chassis 3 and a camera set at the front end of the slave arm, and the camera set in the middle of the bracket 4 can also be added according to actual user needs; as shown in FIG. Figure 6-Figure 9 As shown, the images are taken by the first camera 9, the second camera 8, the third camera 5 and the fourth camera 7 respectively. The settings of the specific cameras can be reduced or increased according to user needs, which can effectively identify the position of the target object 6 and help predict the next step position during the forward propagation of the model.
[0076] S200, training an ACT robotic arm automatic training model using a training data set and a verification data set of the first position information of the master arm and the first object information of the slave arm;
[0077] Specifically, the training of the ACT robotic arm automatic training model using the training data set and the verification data set of the first position information of the master arm and the first object information of the slave arm includes:
[0078] Inputting the training data set of the first position information of the master arm and the first object information of the slave arm into a preset network layer in batches for training, wherein the preset network layer includes a ResNet network layer and a Transformer network layer, wherein the ResNet network layer is used to identify the position of the target object through the image information of the camera in the training data set and the verification data set, and the Transformer network layer is used to predict the next position according to the forward propagation of the current position, thereby obtaining the predicted loss value;
[0079] Calculate the loss value of the preset network layer and input it into the optimizer for optimization, and determine the direction in which the parameter gradient of the ACT robotic arm automatic training model descends fastest;
[0080] The ACT robotic arm automatic training model performs back propagation according to the loss value and the parameter gradient of the model to optimize the parameters of the ACT robotic arm automatic training model.
[0081] It should be noted here that ResNet is a deep convolutional neural network that solves the gradient vanishing problem in deep network training by introducing residual connections. The core component of ResNet is the residual block, which usually contains two or three convolutional layers and a jump connection, which allows the gradient to bypass these convolutional layers directly. The network structure of ResNet can be very deep. These networks extract image features by stacking multiple residual blocks and perform classification tasks through global average pooling and fully connected layers; Transformer is a deep learning model based on the self-attention mechanism, which consists of a multi-head attention mechanism and a feedforward neural network. It can process sequence data and capture long-distance dependencies. The ansformer model does not contain traditional convolutional layers, but processes each element in the input sequence through an attention layer. The typical structure of Transformer includes an encoder and a decoder, wherein the encoder is composed of multiple identical layers stacked together, and the decoder adds a self-attention layer on the basis of the encoder to process the sequence generation task. The present invention combines the ResNet network layer and the Transformer network layer. ResNet is good at extracting local features in images, while Transformer can supplement global context information. This combination can enhance the model's capabilities in feature extraction and global understanding, greatly improve the performance of the model, and greatly reduce the computational cost.
[0082] It can be understood that the ResNet network layer is used to identify the location of the target object through the image information of the camera in the training data set and the verification data set. The specific steps are:
[0083] (1) First, the image information is put into the Backbones network layer of the model. Backbone refers to a series of convolutional layers that constitute the skeleton of the neural network. The main function of these layers is to extract the features of the input data. The Backbone network is usually composed of multiple convolutional layers, pooling layers, and activation functions. It can extract meaningful feature representations from the original data. Backbones is composed of multiple Backbones, and the core network layer in Backbone is the Resnet network layer. After the data set is input into the model, the image part will be input into Backbones for training;
[0084] (2) When constructing Backbone, position encoding and Resnet network layers were added. After the image is input, Resnet starts training layer by layer to extract features from the image and assist Transformer in predicting actions. The extracted features obtain the position information of the image features with the help of position encoding.
[0085] Specifically, the training data set and the verification data set using the first position information of the master arm and the first object information of the slave arm to train the ACT robot arm automatic training model also include:
[0086] After each training, the verification data set of the first position information of the master arm and the first object information of the slave arm is input into the preset network layer of the previous training in batches to verify the model parameters, and the cyclic training is performed, and the total training round is set to the first preset round;
[0087] Record the loss value of the preset network layer, determine whether the loss value meets the first preset condition, and determine whether to end the training and output the model parameters based on the determination result.
[0088] Specifically, the determining whether the loss value satisfies the first preset condition, and determining whether to end the training and output the model parameters according to the determination result, includes:
[0089] If the loss value meets the first preset condition, the training is terminated and the parameters of the current ACT robot arm automatic training model are output;
[0090] If the loss value does not meet the first preset condition, continue training.
[0091] Specifically, the first preset condition is: after the second preset round of training, the loss values obtained in the next round of training are greater than or equal to the loss values that occurred during the second preset round of training.
[0092] It can be understood that the present invention preferably sets the maximum round of cyclic training to 20,000 times, which can effectively ensure the accuracy of the model prediction of the present invention and record the loss value of the model training. The present invention sets the second preset round to 200, that is, when the loss value of the training no longer decreases within 200 rounds of training, the round with the smallest loss value in the 200 rounds of training is saved as the best verification round parameter to generate the best model file. The above setting makes the training rounds no longer rely on manual judgment, but uses the deep learning model for automatic training, which improves the accuracy of the model prediction, and automatically ends the training when the accuracy meets the requirements, which greatly saves the training time, and can also effectively prevent overfitting, which greatly improves the intelligence level of the present invention and the efficiency of model training.
[0093] Furthermore, the specific process of the ACT robotic arm automatic training model of the present invention is as follows:
[0094] (1) Obtain the potential vector mean mu and logarithmic variance logvar during the forward propagation process of the ACT robotic arm automatic training model;
[0095] (2) Calculate a reasonable loss value representing the training effect:
[0096] Calculate the divergence: k1=-0.5*(1+logvar-mu^2-(e^logvar));
[0097] Calculate the loss between the main arm's position information action and the predicted value:
[0098] loss=L1+k1*k1_weight;
[0099] Among them, loss is the loss value, k1 is the divergence, k1_weight is the proportion of k1, the value is 10, L1 is the absolute difference between the predicted value and the true value, and the calculation formula of L1 is as follows:
[0100] ;
[0101] Among them, A is the L1 loss in pytorch, which calculates the average or sum of the absolute differences between two tensors; A has a shape of N*C*H*W, which indicates that it is a four-dimensional tensor, N represents the number of samples (Batch Size), indicating that there are N data points, C represents the number of channels (Channels), H and W represent the height and width respectively, which are usually the two-dimensional spatial dimensions of the input features; P represents the padding value, which is a Boolean type, and the shape of P is C*H*W*1. The dimensions of P are the same as those of A in terms of channel, height, and width, but there is no sample number N, which means that P is a mask or padding information for a feature map of each sample, and the Boolean value of P may be used to mark whether the elements in A are filled (True) or valid (False).
[0102] (3) The loss value when using the validation data set to validate the current model network;
[0103] (4) If the validation loss of this round is less than that of the previous round, the best model parameters are replaced with the training model of this round;
[0104] (5) Put the rounds and loss values into the dictionary one by one;
[0105] (6) Compare the loss value of the current round with the loss values of the 200 rounds before this round (parameters are provided and can be set according to actual needs, the default is 200), that is, traverse the loss values from epoch-200 to epoch-1 (epoch is the training round, and the comparison is performed when the epoch is greater than 200). If the loss values of the current round of epoch are all greater than the loss values from (epoch-200) to (epoch-1), then stop training.
[0106] (7) Save the best model parameters in the cyclic verification as a ckpt model file.
[0107] S300, using the verification data set to optimize the trained ACT robotic arm automatic training model, optimize the model parameters, and output the optimized model parameter file.
[0108] Specifically, the validation data set is used to optimize the trained ACT robotic arm automatic training model, optimize the model parameters, and output the optimized model parameter file, including:
[0109] Set the parameters of the custom ACT robot arm automatic training model, input the verification data set into the preset network layer to verify the model parameters, and optimize the model parameters according to the output loss value;
[0110] The training is repeated based on the new model parameters until the loss value meets the first preset condition, that is, the model optimization is completed, and the optimized model parameter file is output.
[0111] It is understandable that when the number of training times is not enough and model optimization is desired, since the original model can only be trained from scratch, the present invention develops a parameter file based on the previously trained model to continue model optimization and set custom parameters. According to user needs, the user can choose to set which training parameter to continue training on the basis of to obtain the best model and complete model optimization. This solves the problem in the prior art that when model optimization is required, the results of previous training cannot be used, and the efficiency and accuracy of model training are greatly improved.
[0112] It should be noted here that the present invention obtains the first position information of the main arm and the first object information of the slave arm, and divides the first position information of the main arm and the first object information of the slave arm into a training data set and a verification data set according to a first preset ratio; the training data set and the verification data set of the first position information of the main arm and the first object information of the slave arm are used to train the ACT robotic arm automatic training model, which can realize fully automated training of double-arm training and single-arm training, greatly reducing the cost; the verification data set is used to optimize the trained ACT robotic arm automatic training model, optimize the model parameters, and output the optimized model parameter file, which solves the problem that the prior art cannot use the trained model to continue to optimize the model, and greatly improves the performance of the model; the present invention increases the inverse regularization of the opening and closing of the slave arm grasping clamp, greatly improves the accuracy of target grasping, greatly reduces the training time, further improves the efficiency of model training, and greatly improves the intelligence, usability and reliability of the present invention.
[0113] Embodiment 2
[0114] This embodiment provides a method for dual-arm training of a robotic arm, and the specific implementation process is as follows:
[0115] 1. Collection of dual-arm datasets
[0116] Step 1: Build the ROS environment, let the robot arm interact with the server, and realize the movement of the robot arm;
[0117] Step 2: Close the hand grip of the two master arms, use the master arm to teleoperate the slave arm, collect the data set, collect the position information action of the master arm, and pass the action to the slave arm;
[0118] Step 3: After obtaining the action from the slave arm, the gripper is processed to generate the object information of the slave arm;
[0119] The process of handling the clamp is as follows:
[0120] Since the opening and closing ranges of the master arm and slave arm are different, the opening and closing ratio of the slave arm is calculated based on the master arm’s grip to achieve equal opening and closing:
[0121] Slave arm grip closure value = -0.6213;
[0122] Opening value from arm grip = 1.4910;
[0123] Calculate the opening and closing of the slave arm clamp based on the master arm clamp:
[0124] Slave arm clamp = master arm clamp * (1.4910-(-0.6213))-0.6313;
[0125] Step 4: Write the above-obtained information (master arm action, slave arm object information) into an array of length 14 respectively, and then integrate and write it into the hd5 file to complete the collection of the data set;
[0126] The object information of the slave arm includes position information qpos, velocity information qvel, force information effort and camera image information images. The array type is set to (1, 14), which contains 14 floating-point numbers. The 1st to 6th numbers store the left arm position information, and the 7th number stores the left gripper position information; the 8th to 13th numbers store the right arm position information, and the 14th number stores the right gripper position information.
[0127] There are 4 cameras in total, including a top camera, a front camera, a left arm camera and a right arm camera (the top and front cameras can be reduced as needed). The camera image information format is set to (480, 640, 3), that is, the resolution is 480*640, the color depth is 3, and two wx250s master arms and two vx300s slave arms are required.
[0128] 2. Model training
[0129] Step 1: Build an ACT training model, input the training data set, and select parameters such as batch and file path for model training;
[0130] Step 2: Create a training model. The model mainly uses the ResNet network layer and the Transformer network layer. The specific structure of the model is as follows Figure 3 As shown;
[0131] Step 3: Put the training data set into the network model in batches. ResNet is responsible for identifying the location of the target object through the image information in the data set, and Transformer predicts the next location based on the current location through forward propagation to obtain the predicted loss value. The forward propagation is as follows: Figure 4 As shown;
[0132] Step 4: After obtaining the loss value, perform back propagation, calculate the gradient, and put it into the optimizer to optimize along the gradient direction;
[0133] Step 5: After completing one training, perform model parameter verification, that is, use the verification data set to be put into the parameter network layer obtained in the previous training in batches, and perform forward propagation to obtain the loss value;
[0134] Step 6: Cycle training. The number of training rounds can be set to 20,000. The loss value of the training is recorded. When the loss of the training no longer decreases within 200 rounds of training, the parameters of the best validation round are saved to generate the best model file.
[0135] 3. Model Optimization
[0136] When the number of training times is not enough and you want to optimize the model, the original aloha project can only train from scratch, so a method based on the previously trained model parameter file is developed to continue the following training;
[0137] (1) Provide custom parameters, and users can choose to set the training parameters based on which training to continue training according to their needs;
[0138] (2) Load the parameters of the custom model file;
[0139] (3) Put the validation data set into the custom parameter network layer for validation, obtain the loss value and record the best model parameters;
[0140] (4) Based on this set of model parameters, forward propagation training and back propagation are performed, and the optimizer optimizes the parameters to obtain a new set of data;
[0141] (5) Put the verification data into the new data network layer for inference to obtain the loss value;
[0142] (6) Perform cyclic training to obtain the best model and complete model optimization.
[0143] 4. Model application
[0144] Step 1: Build the ROS environment and let the two slave arms interact with the server to realize the movement of the arm:
[0145] Step 2: Load the best model parameter file and pass it to the network layer;
[0146] Step 3: Ros connects the real robot and the dual-slave arm camera and other cameras;
[0147] Step 4: Adjust the robotic arm to the initial state, and obtain the position, speed, force information of the robotic arm's current state and the image information of the camera;
[0148] Step 5: Pass the above information to the network model, perform forward propagation reasoning, and continue to pass it to the network model after obtaining the reasoning state information;
[0149] Step 6: When the grasping information is transmitted and obtained, the grasping information is subjected to reverse normalization processing;
[0150] Step 7: After completing an action, return to the initial state after a predetermined time (default 20 seconds) and continue the reasoning task.
[0151] It should be further explained that, the present invention obtains the first position information of the main arm and the first object information of the slave arm, and divides the first position information of the main arm and the first object information of the slave arm into a training data set and a verification data set according to a first preset ratio; the training data set and the verification data set of the first position information of the main arm and the first object information of the slave arm are used to train the ACT robotic arm automatic training model, so as to realize the fully automated training of dual-arm training and greatly reduce the cost; the verification data set is used to optimize the trained ACT robotic arm automatic training model, optimize the model parameters, and output the optimized model parameter file, so as to solve the problem that the prior art cannot use the trained model to continue to optimize the model, and greatly improve the performance of the model; the present invention increases the reverse regularization of the opening and closing of the slave arm grasping clamp, greatly improves the accuracy of target grasping, greatly reduces the training time, further improves the efficiency of model training, and greatly improves the intelligence, usability and reliability of the present invention.
[0152] Embodiment 3
[0153] 1. Single-arm dataset collection
[0154] Step 1: Build the ROS environment, let the robot arm interact with the server, and realize the movement of the robot arm;
[0155] Step 2: Close the hand grip of the two master arms, use the master arm to teleoperate the slave arm, collect the data set, collect the position information action of the master arm, and pass the action to the slave arm;
[0156] Step 3: After obtaining the action from the slave arm, the gripper is processed to generate the object information of the slave arm;
[0157] The process of handling the clamp is as follows:
[0158] (1) If the main arm and the slave arm are of the same model, the opening and closing of the clamp is basically the same, and the clamping of the slave arm is not calculated;
[0159] (2) Master arm model wx250s, slave arm model vx300s:
[0160] Slave arm grip closure value = -0.6213;
[0161] Opening value from arm grip = 1.4910;
[0162] Calculate the opening and closing of the slave arm clamp based on the main arm clamp:
[0163] Slave arm clamp = master arm clamp * (1.4910-(-0.6213))-0.6313;
[0164] (3) Master arm model vx300s, slave arm model wx250s:
[0165] Slave arm grip closure value = -0.6842;
[0166] Opening value from arm grip = 0.3083;
[0167] Calculate the opening and closing of the slave arm clamp based on the main arm clamp:
[0168] Slave arm grip = master arm grip * (0.3083-(-0.6842))-0.6842;
[0169] Step 4: Write the above-obtained information (master arm action, slave arm object information) into an array of length 7, then expand the array to 14, set the values of 8-14 equal to 1-7, and then integrate them into the hd5 file to complete the collection of the data set;
[0170] The object information of the slave arm includes position information qpos, velocity information qvel, force information effort and camera image information images. The array type is set to (1, 7), which contains 7 floating-point numbers. The 1st to 6th numbers store the left arm position information, and the 7th number stores the left gripper position information.
[0171] There are 2 cameras in total, including a front camera and a slave arm camera (a top camera can be added as needed). The camera image information format is set to (480, 640, 3), that is, the resolution is 480*640, and the color depth is 3. A master arm and a slave arm are required. The model is customized. By modifying the parameters according to the model, you can collect data sets for training.
[0172] 2. Model training
[0173] Step 1: Build an ACT training model, add objects containing two identical slave arm information and actions containing two master arm information to the model for single-arm training;
[0174] Step 2: Create a training model. The model mainly uses the ResNet network layer and the Transformer network layer. The specific structure of the model is as follows Figure 3 As shown;
[0175] Step 3: Put the training data set into the network model in batches. ResNet is responsible for identifying the location of the target object through the image information in the data set, and Transformer predicts the next location based on the current location through forward propagation to obtain the predicted loss value. The forward propagation is as follows: Figure 4 As shown;
[0176] Step 4: After obtaining the loss value, perform back propagation, calculate the gradient, and put it into the optimizer to optimize along the gradient direction;
[0177] Step 5: After completing one training, perform model parameter verification, that is, use the verification data set to be put into the parameter network layer obtained in the previous training in batches, and perform forward propagation to obtain the loss value;
[0178] Step 6: Cycle training. The number of training rounds can be set to 20,000. The loss value of the training is recorded. When the loss of the training no longer decreases within 200 rounds of training, the parameters of the best validation round are saved to generate the best model file.
[0179] 3. Model Optimization
[0180] Optimize the model based on the previously trained model parameter file:
[0181] (1) Provide custom parameters, and users can choose to set the training parameters based on which training to continue training according to their needs;
[0182] (2) Load the parameters of the custom model file;
[0183] (3) Put the validation data set into the custom parameter network layer for validation, obtain the loss value and record the best model parameters;
[0184] (4) Based on this set of model parameters, forward propagation training and back propagation are performed, and the optimizer optimizes the parameters to obtain a new set of data;
[0185] (5) Put the verification data into the new data network layer for inference to obtain the loss value;
[0186] (6) Perform cyclic training to obtain the best model and complete model optimization.
[0187] 4. Model Application
[0188] Step 1: Build the ROS environment and let the two slave arms interact with the server to realize the movement of the arm:
[0189] Step 2: Load the best model parameter file and pass it to the network layer;
[0190] Step 3: Ros connects the real robot and the left slave arm camera and other cameras;
[0191] Step 4: Adjust the robotic arm to the initial state, and obtain the position, speed, force information of the robotic arm's current state and the image information of the camera;
[0192] Step 5: Copy the above information into the object information representing the left slave arm, pass the information to the network model, and forward propagate to obtain the position information of the right slave arm and the left slave arm, and control them to move;
[0193] Step 6: Move to the new position and continue to pass the right slave arm position information to the network model until the entire action is completed (the left and right slave arms perform the same action synchronously).
[0194] It should be noted here that the present invention obtains the first position information of the main arm and the first object information of the slave arm, and divides the first position information of the main arm and the first object information of the slave arm into a training data set and a verification data set according to a first preset ratio; the training data set and the verification data set of the first position information of the main arm and the first object information of the slave arm are used to train the ACT robotic arm automatic training model, so as to realize the fully automated training of single arm training and greatly reduce the cost; the verification data set is used to optimize the trained ACT robotic arm automatic training model, optimize the model parameters, and output the optimized model parameter file, which solves the problem that the prior art cannot use the trained model to continue to optimize the model, and greatly improves the performance of the model; the present invention increases the inverse regularization of the opening and closing of the slave arm grasping clamp, greatly improves the accuracy of target grasping, greatly reduces the training time, further improves the efficiency of model training, and greatly improves the intelligence, usability and reliability of the present invention.
[0195] Embodiment 4
[0196] See also Figure 2 , this embodiment provides a deep learning-based robotic arm automatic training system, the system comprising:
[0197] Acquisition module 100: using the master arm of the robot arm to remotely operate the slave arm to collect data, acquiring first position information of the master arm and first object information of the slave arm, and dividing the first position information of the master arm and the first object information of the slave arm into a training data set and a verification data set according to a first preset ratio;
[0198] Control module 200: train the ACT robotic arm automatic training model using a training data set and a verification data set of the first position information of the master arm and the first object information of the slave arm; or optimize the trained ACT robotic arm automatic training model using a verification data set, optimize the model parameters, and output the optimized model parameter file.
[0199] It should be noted here that the present invention obtains the first position information of the main arm and the first object information of the slave arm, and divides the first position information of the main arm and the first object information of the slave arm into a training data set and a verification data set according to a first preset ratio; the training data set and the verification data set of the first position information of the main arm and the first object information of the slave arm are used to train the ACT robotic arm automatic training model, which can realize fully automated training of double-arm training and single-arm training, greatly reducing the cost; the verification data set is used to optimize the trained ACT robotic arm automatic training model, optimize the model parameters, and output the optimized model parameter file, which solves the problem that the prior art cannot use the trained model to continue to optimize the model, and greatly improves the performance of the model; the present invention increases the inverse regularization of the opening and closing of the slave arm grasping clamp, greatly improves the accuracy of target grasping, greatly reduces the training time, further improves the efficiency of model training, and greatly improves the intelligence, usability and reliability of the present invention.
[0200] Embodiment 5
[0201] In a preferred embodiment, the present application further provides an electronic device, the electronic device comprising:
[0202] A memory; and a processor, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the method for automatic training of a robotic arm based on deep learning is implemented. The computer device can be broadly a server, a terminal, or any other electronic device with necessary computing and / or processing capabilities. In one embodiment, the computer device may include a processor, a memory, a network interface, a communication interface, etc. connected via a system bus. The processor of the computer device can be used to provide necessary computing, processing and / or control capabilities. The memory of the computer device may include a non-volatile storage medium and an internal memory. An operating system, a computer program, etc. may be stored in or on the non-volatile storage medium. The internal memory may provide an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface and the communication interface of the computer device can be used to connect and communicate with external devices via a network. When the computer program is executed by the processor, the steps of the method of the present invention are performed.
[0203] The present invention may be implemented as a computer-readable storage medium having a computer program stored thereon, which causes the steps of the method of an embodiment of the present invention to be executed when executed by a processor. In one embodiment, the computer program is distributed on a plurality of computer devices or processors coupled to a network so that the computer program is stored, accessed and executed in a distributed manner by one or more computer devices or processors. A single method step / operation, or two or more method steps / operations, may be performed by a single computer device or processor or by two or more computer devices or processors. One or more method steps / operations may be performed by one or more computer devices or processors, and one or more other method steps / operations may be performed by one or more other computer devices or processors. One or more computer devices or processors may perform a single method step / operation, or perform two or more method steps / operations.
[0204] It will be appreciated by those skilled in the art that the method steps of the present invention may be performed by instructing related hardware such as a computer device or a processor through a computer program, and the computer program may be stored in a non-temporary computer-readable storage medium, which causes the steps of the present invention to be performed when the computer program is executed. Depending on the circumstances, any reference to memory, storage, database, or other media herein may include non-volatile and / or volatile memory. Examples of non-volatile memory include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), flash memory, magnetic tape, floppy disk, magneto-optical data storage device, optical data storage device, hard disk, solid state disk, etc. Examples of volatile memory include random access memory (RAM), external cache memory, etc.
[0205] It should be noted here that the present invention obtains the first position information of the main arm and the first object information of the slave arm, and divides the first position information of the main arm and the first object information of the slave arm into a training data set and a verification data set according to a first preset ratio; the training data set and the verification data set of the first position information of the main arm and the first object information of the slave arm are used to train the ACT robotic arm automatic training model, which can realize fully automated training of double-arm training and single-arm training, greatly reducing the cost; the verification data set is used to optimize the trained ACT robotic arm automatic training model, optimize the model parameters, and output the optimized model parameter file, which solves the problem that the prior art cannot use the trained model to continue to optimize the model, and greatly improves the performance of the model; the present invention increases the inverse regularization of the opening and closing of the slave arm grasping clamp, greatly improves the accuracy of target grasping, greatly reduces the training time, further improves the efficiency of model training, and greatly improves the intelligence, usability and reliability of the present invention.
[0206] The various technical features described above can be combined arbitrarily. Although all possible combinations of these technical features are not described, any combination of these technical features should be considered to be covered by this specification as long as there is no contradiction in such combination.
[0207] The specific implementation of the present invention described above does not constitute a limitation on the protection scope of the present invention. Any other corresponding changes and modifications made based on the technical concept of the present invention should be included in the protection scope of the claims of the present invention.
Claims
1. A deep learning-based automatic training method for a robotic arm, characterized in that: include: S100, using the master arm of the robot arm to remotely operate the slave arm to collect data, obtain first position information of the master arm and first object information of the slave arm, and divide the first position information of the master arm and the first object information of the slave arm into a training data set and a verification data set according to a first preset ratio; S200, training an ACT robotic arm automatic training model using a training data set and a verification data set of the first position information of the master arm and the first object information of the slave arm; S300, using the verification data set to optimize the trained ACT robotic arm automatic training model, optimize the model parameters, and output the optimized model parameter file; The method of using the master arm of the robot arm to remotely operate the slave arm to collect data and obtain first position information of the master arm and first object information of the slave arm includes: collecting first position information of the master arm, and transmitting the first position information to the slave arm; Acquire the models of the master arm and the slave arm of the robot arm input by the user, and perform a first preprocessing on the gripping opening and closing angle of the slave arm according to the models of the master arm and the slave arm of the robot arm input by the user; Generate first object information of the slave arm, and write the first object information into an array having a length of a first preset length, thereby completing data collection; The obtaining of the models of the master arm and the slave arm of the mechanical arm input by the user, and performing a first preprocessing on the gripping opening and closing angle of the slave arm according to the models of the master arm and the slave arm of the mechanical arm input by the user, comprises: Obtain the models of the master arm and the slave arm of the robot arm input by the user, determine whether the models of the master arm and the slave arm are consistent, and determine whether to calculate the opening and closing ratio of the slave arm gripping clamp based on the master arm gripping clamp according to the determination result; If the models of the master arm and the slave arm are the same, that is, the opening and closing ranges of the master arm and the slave arm are the same, the opening and closing ratio of the slave arm's gripper will not be calculated; If the models of the master arm and the slave arm are inconsistent, that is, the opening and closing ranges of the master arm and the slave arm are inconsistent, the opening and closing ratio of the slave arm clamp is calculated according to the opening and closing angle of the master arm clamp according to the first preset formula; The first object information of the slave arm includes: The position information of the slave arm, the speed information of the slave arm, the force information of the slave arm, and the image information of the camera; The image information of the camera comprises: image information of the slave arm and the target (6) captured frame by frame by a camera arranged at a preset position in the process of the slave arm grasping the target (6) from the starting point, and capable of simultaneously capturing the slave arm and the target (6), wherein the camera at the preset position comprises at least one of the following: a first camera (9) arranged at the front end of the first slave arm (1), a second camera (8) arranged at the front end of the second slave arm (2), a third camera (5) arranged at the edge of the chassis (3), and a fourth camera (7) arranged in the middle of the bracket (4); When performing double-arm training, the position information, speed information, force information, and camera image information of the slave arm are respectively written into an array of length 14, which contains 14 floating-point numbers, of which numbers 1-6 store the left arm position information, the 7th number stores the left arm grasping position information, the 8th-13th numbers store the right arm position information, and the 14th number stores the right arm grasping position information, and then integrated into the hd5 file to complete the collection of the double-arm data set; when performing single-arm training, the position information, speed information, force information, and camera image information of the slave arm are respectively written into an array of length 7, and then the array is expanded to 14 bits, and the values of 8-14 are made equal to the values of 1-7, of which numbers 1-6 store the left arm position information, and the 7th number stores the left arm grasping position information, and then integrated into the hd5 file to complete the collection of the single-arm data set.
2. The deep learning-based automatic training method for a robotic arm according to claim 1, characterized in that: The method of training the ACT robot arm automatic training model using the training data set and the verification data set of the first position information of the master arm and the first object information of the slave arm comprises: Inputting the training data set of the first position information of the master arm and the first object information of the slave arm into a preset network layer in batches for training, wherein the preset network layer includes a ResNet network layer and a Transformer network layer, wherein the ResNet network layer is used to identify the position of the target object through the image information of the camera in the training data set and the verification data set, and the Transformer network layer is used to predict the next position according to the forward propagation of the current position, thereby obtaining the predicted loss value; Calculate the loss value of the preset network layer and input it into the optimizer for optimization, and determine the direction in which the parameter gradient of the ACT robotic arm automatic training model descends fastest; The ACT robotic arm automatic training model performs back propagation according to the loss value and the parameter gradient of the model to optimize the parameters of the ACT robotic arm automatic training model.
3. The deep learning-based automatic training method for a robotic arm according to claim 2, characterized in that: The method further comprises: using a training data set and a verification data set of the first position information of the master arm and the first object information of the slave arm to train the ACT robot arm automatic training model; After each training, the verification data set of the first position information of the master arm and the first object information of the slave arm is input into the preset network layer of the previous training in batches to verify the model parameters, and the cyclic training is performed, and the total training round is set to the first preset round; Record the loss value of the preset network layer, determine whether the loss value meets the first preset condition, and determine whether to end the training and output the model parameters based on the determination result.
4. The deep learning-based automatic training method for a robotic arm according to claim 3, characterized in that: The determining whether the loss value satisfies the first preset condition, and determining whether to end the training and output the model parameters according to the determination result, includes: If the loss value meets the first preset condition, the training is terminated and the parameters of the current ACT robot arm automatic training model are output; If the loss value does not meet the first preset condition, continue training.
5. The deep learning-based automatic training method for a robotic arm according to claim 4, characterized in that: The first preset condition is that after the second preset round of training, the loss values obtained in the next round of training are greater than or equal to the loss values that occurred during the second preset round of training.
6. The deep learning-based automatic training method for a robotic arm according to claim 1, characterized in that: The method of optimizing the trained ACT robot arm automatic training model using the validation data set, optimizing the model parameters, and outputting the optimized model parameter file includes: Set the parameters of the custom ACT robot arm automatic training model, input the verification data set into the preset network layer to verify the model parameters, and optimize the model parameters according to the output loss value; The training is repeated based on the new model parameters until the loss value meets the first preset condition, that is, the model optimization is completed, and the optimized model parameter file is output.
7. A deep learning-based robotic arm automatic training system, characterized in that: The deep learning-based automatic training method for a robotic arm according to any one of claims 1 to 6 comprises: An acquisition module: using the master arm of the robot arm to remotely operate the slave arm to collect data, acquiring first position information of the master arm and first object information of the slave arm, and dividing the first position information of the master arm and the first object information of the slave arm into a training data set and a verification data set according to a first preset ratio; Control module: train the ACT robotic arm automatic training model using the training data set and verification data set of the first position information of the master arm and the first object information of the slave arm; or optimize the trained ACT robotic arm automatic training model using the verification data set, optimize the model parameters, and output the optimized model parameter file.
8. An electronic device, characterized in that: include: Memory; and a processor, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the deep learning-based automatic training method for a robotic arm is implemented according to any one of claims 1 to 6.
