Patent Publication Number: US-2021170580-A1

Title: Action imitation method and robot and computer readable medium using the same

Description:
CROSS REFERENCE TO RELATED APPLICATIONS 
     The present disclosure claims priority to Chinese Patent Application No. 201911227303.6, filed Dec. 4, 2019, which is hereby incorporated by reference herein as if set forth in its entirety. 
     BACKGROUND 
     1. Technical Field 
     The present disclosure relates to robot technology, and particularly to an action imitation method as well as a robot and a computer readable storage medium, using the same. 
     2. Description of Related Art 
     In the prior art, humanoid robots to a certain extent can already motion by imitating human&#39;s motions so as to, for example, grasp, walk upright with two feet, or the like. However, they still appear blunt in imitating some human habitual motions and are not personified enough, hence it is necessary to have a method to directly transfer human motions to robots. The existing action imitation methods can be categorized into two types, one is wearable control device-based action imitation method, and the other is vision-based action imitation method. The first (wearable control device-based) method requires the user to wear a specific equipment to collect motion information of the joints of the human body of the user so as to synchronize to the corresponding joints of a humanoid robot. The data obtained by the first method is more accurate, but the shortcoming is also very obvious that the wearable control device have high production cost and maintenance cost, which is not suitable for mass popularization and the application scenarios are extremely limited because it is limited to laboratory operations while the processes of wearing and assembling/disassembling are cumbersome and poor in user experience. The second (vision-based) method can effectively improve the problems encountered by the first method because action imitations can be realized through a depth camera built into the humanoid robot or a depth camera disposed in the exterior environment without using additional equipment, which greatly expands the application scenarios. However, because the second method requires the help of a high-precision depth camera which has high cost, it is difficult to popularize. 
    
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
       In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure, the drawings used in the embodiments or the description of the prior art will be briefly introduced below. It should be understood that, the drawings in the following description are only examples of the present disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without creative works. 
         FIG. 1  is a flow chart of an embodiment of an action imitation method according to the present disclosure. 
         FIG. 2  is a schematic diagram of an application scenario according to the embodiment of  FIG. 1 . 
         FIG. 3  is a schematic diagram of each key point according to the embodiment of  FIG. 1 . 
         FIG. 4  is a flow chart of training a convolutional neural network according to the embodiment of  FIG. 1 . 
         FIG. 5  is a schematic diagram of a jointly movement between linkages according to the embodiment of  FIG. 1 . 
         FIG. 6  is a schematic block diagram of an action imitation apparatus according to an embodiment of the present disclosure. 
         FIG. 7  is a schematic block diagram of a robot according to an embodiment of the present disclosure. 
     
    
    
     DETAILED DESCRIPTION 
     In order to make the objects, features and advantages of the present disclosure more obvious and easy to understand, the technical solutions in this embodiment will be clearly and completely described below with reference to the drawings. Apparently, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present disclosure without creative efforts are within the scope of the present disclosure. 
     It is to be understood that, when used in the description and the appended claims of the present disclosure, the term “including” (or “comprising”) indicates the presence of stated features, integers, steps, operations, elements and/or components, but do not preclude the presence or addition of one or a plurality of other features, integers, steps, operations, elements, components and/or combinations thereof. 
     It is also to be understood that, the terminology used in the description of the present disclosure is only for the purpose of describing particular embodiments and is not intended to limit the present disclosure. As used in the description and the appended claims of the present disclosure, the singular forms “one”, “a”, and “the” are intended to include the plural forms as well, unless the context clearly indicates otherwise. 
     It is also to be further understood that the term “and/or” used in the description and the appended claims of the present disclosure refers to any combination of one or more of the associated listed items and all possible combinations, and includes such combinations. 
     As used in the description and the appended claims, the term “if” may be interpreted as “when” or “once” or “in response to determining” or “in response to detecting” according to the context. Similarly, the phrase “if determined” or “if [the described condition or event] is detected” may be interpreted as “once determining” or “in response to determining” or “on detection of [the described condition or event]” or “in response to detecting [the described condition or event]”. 
     In addition, in the present disclosure, the terms “first”, “second”, “third”, and the like in the descriptions are only used for distinguishing, and cannot be understood as indicating or implying relative importance. 
       FIG. 1  is a flow chart of an embodiment of an action imitation method according to the present disclosure. In this embodiment, an action imitation method is provided. The method is a computer-implemented method executable for a processor, which may be implemented through an action imitation apparatus as shown in  FIG. 6  or implemented through a robot as shown in  FIG. 7 . As shown in  FIG. 1 , the method includes the following steps. 
     S 101 : collecting a plurality of action images of a to-be-imitated object. 
       FIG. 2  is a schematic diagram of an application scenario according to the embodiment of  FIG. 1 . As shown in  FIG. 2 , in this embodiment, the icon on the left represents a humanoid robot R which executes the action imitation method, and the icon on the middle represents an operator, that is, a to-be-imitated object O. The humanoid robot R can imitate the actions of the operator O. In other embodiments, the robot can be other type of robot such as robot dog. 
     In this embodiment, as an example, the action images of the to-be-imitated object O can be collected through a camera disposed on the humanoid robot R itself; as another example, the action images of the to-be-imitated object can be collected through an external camera C disposed at a designated location (as the icon on the upper left of  FIG. 2 ). It should be noted that, the camera is an ordinary RGB camera, and the collected action images are two-dimensional RGB images, which are images composed of three color channels of red (R), green (G), and blue (B). The size of the action image can be set according to actual needs, for example, it can be set to 456 pixels×256 pixels, while it can also be set to other sizes, which is not limited herein. 
     S 102 : processing the action images through a pre-trained convolutional neural network to obtain a position coordinate set of position coordinates of a plurality of key points of each of the action images. 
     In this embodiment, each position coordinate set includes two-dimensional position coordinates of each key point of an action image.  FIG. 3  is a schematic diagram of each key point according to the embodiment of  FIG. 1 . In which, the two-dimensional position coordinates of 18 key points shown in the figure can be denoted in sequence as: key point 0: (X 0 , Y 0 ), key point 1: (X 1 , Y 1 ), key point 2: (X 2 , Y 2 ), . . . , key point 16: (X 16 , Y 16 ), and key point 17: (X 17 , Y 17 ). 
     In this embodiment, the convolutional neural network may be any existing convolutional neural network. As an example, a convolutional neural network designed by combining a convolutional pose machine (CPM) and a heatmap can be used. The convolutional neural network can be trained in two stages from coarse to fine, where the backbone network uses resnet  18 , and the network structure is pruned and trimmed so that it can achieve real-time processing of the processor of the humanoid robot while ensuring that the accuracy will not lost too much. 
     In this embodiment, the convolutional neural network is trained through the process shown in  FIG. 4  in advance: 
     S 102   a : obtaining a preset training sample set. 
     The training sample set includes N sample images (N is a positive integer), and each sample image corresponds to one pre-labeled position coordinate set denoted as a first set herein. The first set can be stored as a JSON (JavaScript object notation) file that includes the two-dimensional position coordinates of each key point in the corresponding sample image. The training sample set can use various public image data sets including but not limited to MSCOCO, ImageNet, Open Images Dataset, CIFAR-10 or other image data sets. 
     S 102   b : using the convolutional neural network to process each sample image in the training sample set to obtain a second set corresponding to each sample image. 
     For each sample image, the corresponding second set also includes two-dimensional position coordinates of each key point in the sample image. But it should be noted that, the first set is the labeled expected output, and the second set is the actual output. 
     S 102   c : calculating a training loss of the training sample set according to the first set and the second set corresponding to each sample image. 
     As an example, a second-order Gaussian function processing is performed on each of the position coordinate of each key point of the first set and the second set to obtain a Gaussian heat map at the position coordinate of each key point, and training losses of all pixels within the Gaussian heat map at the position coordinate of each key point of the first set and the Gaussian heat map at the position coordinate of the key points corresponding to the second set are calculated to take as the training loss of the training sample set. 
     S 102   d : determining whether the training loss is larger than a preset loss threshold. 
     The value of the loss threshold can be set according to actual needs. If the training loss is larger than the loss threshold, step S 102   e  is executed; otherwise, if the training loss is less than or equal to the loss threshold, step S 102   f  is executed. 
     S 102   e : adjusting parameters of the convolutional neural network. 
     After adjusting the parameter, return to step S 102   b , that is, start the next round of training. 
     In this embodiment, it is assumed that the parameters of the convolutional neural network in the initial state are W 1 , and the calculated training loss is used to adjust the parameter W 1  of the convolutional neural network through backpropagation so as to obtain the adjusted parameters W 2 . After adjusting the parameters, continue to execute the step S 102   b  of using the convolutional neural network to process each sample image in the training sample set, that is, start the next round of training. During the round of training, the second set corresponding to each sample image is obtained, and the training loss of the training sample set is calculated based on the first set and the second set corresponding to each sample image, and then the training loss is used to adjust the parameter W 2  of the convolutional neural network through backpropagation to obtain the adjusted parameters W 3 , . . . , and so on. The forgoing process is repeated continuously until the training loss is less than or equal to the loss threshold. 
     S 102   f : terminating the training to obtain the pre-trained convolutional neural network. 
     If the training loss is smaller than or equal to the loss threshold, it indicates that the convolutional neural network has converged, and the training can be terminated at this time, where the trained convolutional neural network is the pre-trained convolutional neural network. 
     After the pre-trained convolutional neural network is obtained, the pre-trained convolutional neural network can be used to process the action images, thereby obtaining the position coordinate set corresponding to the action images. 
     Furthermore, considering that the two-dimensional position coordinates of the key points in the position coordinate set that are output by the convolutional neural network may sometimes jump and cannot be directly applied to the robot, in this embodiment, after the two-dimensional position coordinates of each key point are obtained, a Kalman filtering can be performed on the two-dimensional position coordinates of each key point in the position coordinate set to obtain a filtered position coordinate set, so as to ensure its smoothness. Unless otherwise specified, the position coordinate set mentioned below refers to the filtered position coordinate set. 
     S 103 : calculating a rotational angle of each of the linkages of the to-be-imitated object based on the position coordinate sets of the action images. 
     First, a length of each of the linkages of the to-be-imitated object is calculated based on the position coordinate set. 
     Referring to  FIG. 3 , 17 linkages are shown, namely: (0,14), (0,15), (14,16), (15,17), (0,1), (1,2), (1,5), (2,3), (3,4), (5,6), (6,7), (1,8), (1,11), (8,9), (9,10), (11,12), and (12,13). In which, (0,14) represents the linkage between key point 0 and key point 14, by calculating the distance between key point 0 and key point 14, the length of the linkage (0,14) can be obtained; (0,15) represents the linkage between key point 0 and key point 15, by calculating the distance between key point 0 and key point 15, the length of the linkage (0,15) can be obtained; and so on. 
     Then, the rotational angle of each of the linkages of the to-be-imitated object can be calculated based on the length of each of the linkages of the to-be-imitated object and a preset maximum length of each of the linkages of the to-be-imitated object. 
     In an initialization process, the to-be-imitated object can make a flat pose (as shown in  FIG. 3 , but not limited to the illustrated pose) facing the camera in the first few frames, so as to obtain the maximum length of each linkage in these frames to use as a benchmark to determine the changes of the rotational angle of the linkage during the subsequent motions. 
     After calculating the length of each linkage of the to-be-imitated object, the rotational angle of each linkage of the to-be-imitated object can be calculated based on the following formula: calculating the rotational angle of each of the linkages of the to-be-imitated object based on the following formula: 
       cos θ q   =L   q /Max L   q ;
 
     where, q is a serial number of each linkage, 0≤q≤Q−1, Q is the number of the linkages, L q  is the length of the q-th linkage of the to-be-imitated object, and MaxL q  is the maximum length of the q-th linkage of the to-be-imitated object, θ q  is the rotational angle of the q-th linkage of the to-be-imitated object. 
       FIG. 5  is a schematic diagram of a jointly movement between linkages according to the embodiment of  FIG. 1 . Referring to  FIG. 5 , an example of a jointly movement between linkages is shown. The action is perpendicular to an image plane captured by the camera. Linkage (2,3) rotates by an angle r 1 , and linkage (3,4) rotates by an angle r 3 , accordingly. In the initialization process, the maximum length MaxL (2,3)  of linkage (2,3) and the maximum length MaxL (3,4)  of linkage (3,4) are obtained, and the length of the linkage (2,3) and that of the linkage (2,3) calculated according to the action image of the current frame are L (2,3)  and L (3,4) , respectively, then: 
       cos  r   1   =L   (2,3) /Max L   (2,3) ; 
       cos( r   2   +r   3 )= L   (3,4) /Max L   (3,4) ; 
     where, r 2  is the rotational angle of linkage (3, 4) when jointly move with linkage (2, 3), that is, r 1 =r 2 . 
     S 104 : controlling the robot to move according to the rotational angle of each of the linkages of the to-be-imitated object. 
     Furthermore, considering that the calculated rotational angle of each of the linkages of the to-be-imitated object may sometimes jump and cannot be directly applied to the robot, in this embodiment, after the rotational angle of each of the linkages of the to-be-imitated object is obtained, a Kalman filtering can be performed on the rotational angle of each of the linkages of the to-be-imitated object to obtain a filtered rotational angle of each of the linkages, so as to ensure its smoothness. Finally, these rotational angles are mapped to the humanoid robot, and the robot is controlled to perform corresponding movements through its control system, so as to achieve the effect of imitating human actions. 
     In summary, in this embodiment, by collecting a plurality of action images of a to-be-imitated object; processing the action images through a pre-trained convolutional neural network to obtain a position coordinate set of position coordinates of a plurality of key points of each of the action images, where two adjacent ones of the key points are connected to form a plurality of linkages; calculating a rotational angle of each of the linkages of the to-be-imitated object based on the position coordinate sets of the action images; and controlling the robot to move according to the rotational angle of each of the linkages of the to-be-imitated object, the rotational angle of each linkage of the to-be-imitated object can be obtained by just analyzing and processing the images collected by an ordinary camera without the help of high-precision depth camera, and the robot can be controlled to move accordingly, which greatly reduces the required cost and can be easily popularized. 
     It should be understood that, the sequence of the serial number of the steps in the above-mentioned embodiments does not mean the execution order while the execution order of each process should be determined by its function and internal logic, which should not be taken as any limitation to the implementation process of the embodiments. 
       FIG. 6  is a schematic block diagram of an action imitation apparatus according to an embodiment of the present disclosure. In this embodiment, an action imitation apparatus corresponding to the action imitation method described in the forgoing embodiment is provided. As shown in  FIG. 6 , the action imitation apparatus includes: 
     an action image collecting module  601  configured to collect a plurality of action images of a to-be-imitated object; 
     an image processing module  602  configured to process the action images through a pre-trained convolutional neural network to obtain a position coordinate set of position coordinates of a plurality of key points of each of the action images, where two adjacent ones of the key points are connected to form a plurality of linkages; 
     a linkage angle calculating module  603  configured to calculate a rotational angle of each of the linkages of the to-be-imitated object based on the position coordinate sets of the action images; and 
     a motion control module  604  configured to control the robot to move according to the rotational angle of each of the linkages of the to-be-imitated object. 
     Furthermore, the action imitation apparatus may further include: 
     a training sample set obtaining module configured to obtain a preset training sample set, where the training sample set comprises N sample images, and each sample image corresponds to a pre-labeled first set of the position coordinate of each key point, where N is a positive integer; 
     a sample image processing module configured to use the convolutional neural network to process each sample image in the training sample set to obtain a second set of the position coordinate of each key point corresponding to each sample image; 
     a training loss calculating module configured to calculate a training loss of the training sample set according to the first set and the second set corresponding to each sample image; 
     a parameter adjusting module configured to adjust parameters of the convolutional neural network and then returning to the step of using the convolutional neural network to process each sample image in the training sample set, in response to the training loss being larger than a preset loss threshold; and 
     a training terminating module configured to terminate the training to obtain the pre-trained convolutional neural network, in response to the training loss being smaller than or equal to the loss threshold. 
     Furthermore, a second-order Gaussian function processing is performed on each of the position coordinate of each key point of the first set and the second set to obtain a Gaussian heat map at the position coordinate of each key point, and training losses of all pixels within the Gaussian heat map at the position coordinate of each key point of the first set and the Gaussian heat map at the position coordinate of the key points corresponding to the second set are calculated to take as the training loss of the training sample set. 
     Furthermore, the action imitation apparatus may further include: 
     a position coordinate filtering module configured to perform a Kalman filtering on two-dimensional position coordinates of each key point in the position coordinate set. 
     Furthermore, the linkage angle calculating module  603  may include: 
     a linkage length calculating unit configured to calculate a length of each of the linkages of the to-be-imitated object based on the position coordinate set; and 
     a linkage angle calculating unit configured to calculate the rotational angle of each of the linkages of the to-be-imitated object based on the length of each of the linkages of the to-be-imitated object and a preset maximum length of each of the linkages of the to-be-imitated object. 
     Furthermore, the linkage angle calculating unit is configured to calculate the rotational angle of each of the linkages of the to-be-imitated object based on the following formula: 
       cos θ q   =L   q /Max L   q ;
 
     where, q is a serial number of each linkage, 0≤q≤Q−1, Q is the number of the linkages, L q  is the length of the q-th linkage of the to-be-imitated object, and MaxL q  is the maximum length of the q-th linkage of the to-be-imitated object, θ q  is the rotational angle of the q-th linkage of the to-be-imitated object. 
     Furthermore, the action imitation apparatus may further include: 
     a joint angle filtering module configured to perform a Kalman filtering on the rotational angle of each of the linkages of the to-be-imitated object to obtain a filtered rotational angle of each linkage. 
     Those skilled in the art can clearly understand that, for the convenience and conciseness of the description, the specific working processes of the above-mentioned apparatus, modules and units can refer to the corresponding processes in the foregoing method embodiments, which will not be repeated herein. 
     In the above-mentioned embodiments, the description of each embodiment has its focuses, and the parts which are not described or mentioned in one embodiment may refer to the related descriptions in other embodiments. 
       FIG. 7  is a schematic block diagram of a robot according to an embodiment of the present disclosure. In this embodiment, a robot  7  is provided. For ease of description, only a part related to this embodiment is shown. 
     In this embodiment, as shown in  FIG. 7 , the robot  7  includes a processor  70 , a storage  71 , a computer program  72  stored in the storage  71  and executable on the processor  70 , and a camera C. When executing (instructions in) the computer program  72 , the processor  70  implements the steps in the above-mentioned embodiments of the action imitation method, for example, steps S 101 -S 104  shown in  FIG. 1 . Alternatively, when the processor  70  executes (instructions in) the computer program  72 , the functions of each module/unit in the above-mentioned device embodiments, for example, the functions of the modules  701 - 704  shown in  FIG. 7  are implemented. 
     Exemplarily, the computer program  72  may be divided into one or more modules/units, and the one or more modules/units are stored in the storage  71  and executed by the processor  70  to realize the present disclosure. The one or more modules/units may be a series of computer program instruction sections capable of performing a specific function, and the instruction sections are for describing the execution process of the computer program  72  in the robot  7 . 
     It can be understood by those skilled in the art that  FIG. 7  is merely an example of the robot  7  and does not constitute a limitation on the robot  7 , and may include more or fewer components than those shown in the figure, or a combination of some components or different components. For example, the robot  7  may further include an input/output device, a network access device, a bus, and the like. 
     The processor  70  may be a central processing unit (CPU), or be other general purpose processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or be other programmable logic device, a discrete gate, a transistor logic device, and a discrete hardware component. The general purpose processor may be a microprocessor, or the processor may also be any conventional processor. 
     The storage  71  may be an internal storage unit of the robot  7 , for example, a hard disk or a memory of the robot  7 . The storage  71  may also be an external storage device of the robot  7 , for example, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, flash card, and the like, which is equipped on the robot  7 . Furthermore, the storage  71  may further include both an internal storage unit and an external storage device, of the robot  7 . The storage  71  is configured to store the computer program  72  and other programs and data required by the robot  7 . The storage  71  may also be used to temporarily store data that has been or will be output. 
     Those skilled in the art may clearly understand that, for the convenience and simplicity of description, the division of the above-mentioned functional units and modules is merely an example for illustration. In actual applications, the above-mentioned functions may be allocated to be performed by different functional units according to requirements, that is, the internal structure of the device may be divided into different functional units or modules to complete all or part of the above-mentioned functions. The functional units and modules in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional unit. In addition, the specific name of each functional unit and module is merely for the convenience of distinguishing each other and are not intended to limit the scope of protection of the present disclosure. For the specific operation process of the units and modules in the above-mentioned system, reference may be made to the corresponding processes in the above-mentioned method embodiments, and are not described herein. 
     In the above-mentioned embodiments, the description of each embodiment has its focuses, and the parts which are not described or mentioned in one embodiment may refer to the related descriptions in other embodiments. 
     Those ordinary skilled in the art may clearly understand that, the exemplificative units and steps described in the embodiments disclosed herein may be implemented through electronic hardware or a combination of computer software and electronic hardware. Whether these functions are implemented through hardware or software depends on the specific application and design constraints of the technical schemes. Those ordinary skilled in the art may implement the described functions in different manners for each particular application, while such implementation should not be considered as beyond the scope of the present disclosure. 
     In the embodiments provided by the present disclosure, it should be understood that the disclosed apparatus (or device)/robot and method may be implemented in other manners. For example, the above-mentioned apparatus/robot embodiment is merely exemplary. For example, the division of modules or units is merely a logical functional division, and other division manner may be used in actual implementations, that is, multiple units or components may be combined or be integrated into another system, or some of the features may be ignored or not performed. In addition, the shown or discussed mutual coupling may be direct coupling or communication connection, and may also be indirect coupling or communication connection through some interfaces, devices or units, and may also be electrical, mechanical or other forms. 
     The units described as separate components may or may not be physically separated. The components represented as units may or may not be physical units, that is, may be located in one place or be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of this embodiment. 
     In addition, each functional unit in each of the embodiments of the present disclosure may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional unit. 
     When the integrated module/unit is implemented in the form of a software functional unit and is sold or used as an independent product, the integrated module/unit may be stored in a non-transitory computer-readable storage medium. Based on this understanding, all or part of the processes in the method for implementing the above-mentioned embodiments of the present disclosure are implemented, and may also be implemented by instructing relevant hardware through a computer program. The computer program may be stored in a non-transitory computer-readable storage medium, which may implement the steps of each of the above-mentioned method embodiments when executed by a processor. In which, the computer program includes computer program codes which may be the form of source codes, object codes, executable files, certain intermediate, and the like. The computer-readable medium may include any primitive or device capable of carrying the computer program codes, a recording medium, a USB flash drive, a portable hard disk, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM), a random access memory (RAM), electric carrier signals, telecommunication signals and software distribution media. It should be noted that the content contained in the computer readable medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to the legislation and patent practice, a computer readable medium does not include electric carrier signals and telecommunication signals. 
     The above-mentioned embodiments are merely intended for describing but not for limiting the technical schemes of the present disclosure. Although the present disclosure is described in detail with reference to the above-mentioned embodiments, it should be understood by those skilled in the art that, the technical schemes in each of the above-mentioned embodiments may still be modified, or some of the technical features may be equivalently replaced, while these modifications or replacements do not make the essence of the corresponding technical schemes depart from the spirit and scope of the technical schemes of each of the embodiments of the present disclosure, and should be included within the scope of the present disclosure.