Quaternion Product Units for Deep Learning on 3D Rotation Groups
Total Page:16
File Type:pdf, Size:1020Kb
Quaternion Product Units for Deep Learning on 3D Rotation Groups Xuan Zhang1, Shaofei Qin1, Yi Xu∗1, and Hongteng Xu2 1MoE Key Lab of Artificial Intelligence, AI Institute 2Infinia ML, Inc. 1Shanghai Jiao Tong University, Shanghai, China 2Duke University, Durham, NC, USA ffloatlazer, 1105042987, [email protected], [email protected] Abstract methods have made efforts to enhance their robustness to rotations [4,6, 29,3, 26]. However, the architectures of We propose a novel quaternion product unit (QPU) to their models are tailored for the data in the Euclidean space, represent data on 3D rotation groups. The QPU lever- rather than 3D rotation data. In particular, the 3D rotation ages quaternion algebra and the law of 3D rotation group, data are not closed under the algebraic operations used in representing 3D rotation data as quaternions and merg- their models (i:e:, additions and multiplications).1 The mis- ing them via a weighted chain of Hamilton products. We matching between data and model makes these methods dif- prove that the representations derived by the proposed QPU ficult to analyze the influence of rotations on their outputs can be disentangled into “rotation-invariant” features and quantitatively. Although this mismatching problem can be “rotation-equivariant” features, respectively, which sup- mitigated by augmenting training data with additional rota- ports the rationality and the efficiency of the QPU in the- tions [18], this solution gives us no theoretical guarantee. ory. We design quaternion neural networks based on our To overcome the challenge mentioned above, we pro- QPUs and make our models compatible with existing deep posed a novel quaternion product unit (QPU) for 3D ro- learning models. Experiments on both synthetic and real- tation data, which establishes an efficient and interpretable world data show that the proposed QPU is beneficial for mechanism to enhance the robustness of deep learning mod- the learning tasks requiring rotation robustness. els to rotations. As illustrated in Figure 1a, for each 3D ro- tation, we represent it as a unit quaternion, whose imaginary part indicates the direction of its rotation axis, and the real 1. Introduction part corresponds to the cosine of its rotation angle, respec- tively. Taking N quaternions as its inputs, the QPU first ap- Representing 3D data like point clouds and skeletons plies quaternion power operation to each input, scaling their is essential for many real-world applications, such as au- rotation angles and rotation axes, respectively. Then, it ap- tonomous driving [17, 37], robotics [30], and gaming [2, plies a chain of Hamilton products to merge the weighted 16]. In practice, we often model these 3D data as the collec- quaternions and output a rotation accordingly. The parame- tion of points on a 3D rotation group (3), e:g:, a skeleton ters of the QPU consists of the scaling coefficients and the arXiv:1912.07791v2 [cs.CV] 2 Apr 2020 SO can be represented by the rotations between adjacent joints. bias introduced to the rotation angles. Accordingly, the uncertainty hidden in these data is usually The proposed QPU leverages quaternion algebra and the caused by the randomness on rotations. For example, in ac- law of 3D rotation groups, merging the inputs as one quater- tion recognition, the human skeletons with different orienta- nion. Because 3D rotation group is closed under the op- tions may represent the same action [27, 35]; in autonomous erations used in our QPU, the output is still a valid rota- driving, the point clouds with different directions may cap- tion. Moreover, given a dataset SO(3)N , where each X ⊂ ture the same vehicle [37]. Facing to the 3D data with such x = [x1; :::; xN ] contains N rotations, we can de- rotation discrepancies, we often require the corresponding fine two kinds of rotation2 X robustness for a mapping function representation methods to be robust to rotations. f : SO(3)N SO(3): Currently, many deep learning-based representation Rotation-invariance7! f(R(x)) = f(x); x . Rotation-equivariance f(R(x)) = R(f8(x))2; Xx . ∗The corresponding author of this paper is Yi Xu ([email protected]). 8 2 X This work was supported in part by NSFC 61671298, STCSM 1For example, adding two 3D rotation matrices together or multiplying 18DZ2270700, and 111 Plan B07022. a scalar with a 3D rotation matrix will not result in a valid rotation matrix. 3 q =[q ,q ,q ]> <latexit sha1_base64="faJ5eHrwtQ7ihADjNg1ukcJYv/8=">AAACHXicbVDLSsNAFJ3UV62vqEs3g0VwISVpi4+FUHTTZQX7gCYNk+mkHTqZpDMToYT8iBt/xY0LRVy4Ef/GpC2i1gMzHM65l3vvcUNGpTKMTy23tLyyupZfL2xsbm3v6Lt7LRlEApMmDlggOi6ShFFOmooqRjqhIMh3GWm7o+vMb98RIWnAb9UkJLaPBpx6FCOVSo5etXykhq4XjxN4CbtjxzyBY6ecfRW7F1sqCBNoUQ5ndW5cT3oVRy8aJWMKuEjMOSmCORqO/m71Axz5hCvMkJRd0wiVHSOhKGYkKViRJCHCIzQg3ZRy5BNpx9PrEniUKn3oBSJ9XMGp+rMjRr6UE99NK7Md5V8vE//zupHyzu2Y8jBShOPZIC9iUAUwiwr2qSBYsUlKEBY03RXiIRIIqzTQwjSEiwyn3ycvkla5ZFZK1ZtqsXY1jyMPDsAhOAYmOAM1UAcN0AQY3INH8AxetAftSXvV3malOW3esw9+Qfv4AmekoQg=</latexit> 1 2 3 H 2 Quaternion Product Unit q =[s , v ] Weighting Chained <latexit sha1_base64="skCmEW1j8iZiTSYoGF0hGgm/f9k=">AAACAnicbVDLSsNAFJ3UV62vqCtxM1gEF1ISLT4WQtGNywr2AWkIk+mkHTqZxJlJoYTixl9x40IRt36FO//GSVpErQcuHM65l3vv8WNGpbKsT6MwN7+wuFRcLq2srq1vmJtbTRklApMGjlgk2j6ShFFOGooqRtqxICj0GWn5g6vMbw2JkDTit2oUEzdEPU4DipHSkmfu3Hk2vICO9OxD2AmR6vtBOhx7tuuZZati5YCzxJ6SMpii7pkfnW6Ek5BwhRmS0rGtWLkpEopiRsalTiJJjPAA9YijKUchkW6avzCG+1rpwiASuriCufpzIkWhlKPQ153ZkfKvl4n/eU6igjM3pTxOFOF4sihIGFQRzPKAXSoIVmykCcKC6lsh7iOBsNKplfIQzjOcfL88S5pHFfu4Ur2plmuX0ziKYBfsgQNgg1NQA9egDhoAg3vwCJ7Bi/FgPBmvxtuktWBMZ7bBLxjvXzF4li4=</latexit> 1 1 1 Hamilton Product q =[s , v ] <latexit sha1_base64="/E/a8q2+WHcCf0O0pAszmFVJdrk=">AAACAnicbVDLSsNAFJ34rPUVdSVuBovgQkoSi4+FUHTjsoJ9QBrCZDpph04ezkwKJRQ3/oobF4q49Svc+TdO0iBqPXDhcM693HuPFzMqpGF8anPzC4tLy6WV8ura+samvrXdElHCMWniiEW84yFBGA1JU1LJSCfmBAUeI21veJX57RHhgkbhrRzHxAlQP6Q+xUgqydV371wLXkBbuNYR7AZIDjw/HU1cy3H1ilE1csBZYhakAgo0XP2j24twEpBQYoaEsE0jlk6KuKSYkUm5mwgSIzxEfWIrGqKACCfNX5jAA6X0oB9xVaGEufpzIkWBEOPAU53ZkeKvl4n/eXYi/TMnpWGcSBLi6SI/YVBGMMsD9ignWLKxIghzqm6FeIA4wlKlVs5DOM9w8v3yLGlZVfO4WrupVeqXRRwlsAf2wSEwwSmog2vQAE2AwT14BM/gRXvQnrRX7W3aOqcVMzvgF7T3LzYqljE=</latexit> 2 2 2 Rotation Invariant <latexit sha1_base64="CrrIxxh5DpNiciBRzVw1XfUlCOE=">AAAB8XicbVDLSgNBEOyNrxhfUY9eBoPgKWw0+LgFvXiMYB6YLGF2MpsMmZ1ZZmaFsOQvvHhQxKt/482/cXaziBoLGoqqbrq7/IgzbVz30yksLa+srhXXSxubW9s75d29tpaxIrRFJJeq62NNORO0ZZjhtBspikOf044/uU79zgNVmklxZ6YR9UI8EixgBBsr3fd9NpKGhVQPyhW36mZAi6SWkwrkaA7KH/2hJHFIhSEca92ruZHxEqwMI5zOSv1Y0wiTCR7RnqUC2yVekl08Q0dWGaJAKlvCoEz9OZHgUOtp6NvOEJux/uul4n9eLzbBhZcwEcWGCjJfFMQcGYnS99GQKUoMn1qCiWL2VkTGWGFibEilLITLFGffLy+S9km1dlqt39Yrjas8jiIcwCEcQw3OoQE30IQWEBDwCM/w4mjnyXl13uatBSef2YdfcN6/AOcukTU=</latexit> q =[s , v ] <latexit sha1_base64="KoO5naGICEI+n1h4X2tzma7TwW4=">AAACPnicbVBBa9swGJXTbc2ydcvaYy9iYbDDCE4X2u1QCNslxw6WJhCbICufExFZdqXPYUH4l/XS39Dbjrv00FJ23XG2Y0bW9IHg8d73SU8vSKQw6Lo/ndrOk6fPduvPGy9e7r163Xyzf27iVHMY8FjGehQwA1IoGKBACaNEA4sCCcNg8bXwh0vQRsTqO64S8CM2UyIUnGEuTZqDi4mNU8zoKR17CD+wvNJqmGbWrK3sA91wAplCZr2I4TwI7TKrZnxPqLUY2H42abbctluCbpNORVqkwtmkee1NY55GoJBLZsy44yboW6ZRcAlZw0sNJIwv2AzGOVUsAuPbMlFG3+XKlIaxzo9CWqqbG5ZFxqyiIJ8sEpqHXiE+5o1TDD/5VqgkRVB8/VCYSooxLbqkU6GBo1zlhHEt8qyUz5lmHPPGG2UJnwsc//vyNjk/anc+trvfuq3el6qOOjkkb8l70iEnpEf65IwMCCeX5Be5JXfOlXPj3Du/16M1p9o5IP/B+fMXCLGzYw==</latexit> out out out H q =[s , v ] O 2 <latexit sha1_base64="g1JzUogRNPJwWRViH3uwLJ84EBk=">AAACAnicbVDLSsNAFJ34rPUVdSVuBovgQkpiio+FUHTjsoJ9QBrCZDpph04ezkwKJRQ3/oobF4q49Svc+TdO0iBqPXDhcM693HuPFzMqpGF8anPzC4tLy6WV8ura+samvrXdElHCMWniiEW84yFBGA1JU1LJSCfmBAUeI21veJX57RHhgkbhrRzHxAlQP6Q+xUgqydV371wLXkBbuNYR7AZIDjw/HU1cy3H1ilE1csBZYhakAgo0XP2j24twEpBQYoaEsE0jlk6KuKSYkUm5mwgSIzxEfWIrGqKACCfNX5jAA6X0oB9xVaGEufpzIkWBEOPAU53ZkeKvl4n/eXYi/TMnpWGcSBLi6SI/YVBGMMsD9ignWLKxIghzqm6FeIA4wlKlVs5DOM9w8v3yLGkdV02rWrupVeqXRRwlsAf2wSEwwSmog2vQAE2AwT14BM/gRXvQnrRX7W3aOqcVMzvgF7T3LzrcljQ=</latexit> 3 3 3 Rotation Equivariant 3 q =[q ,q ,q ]> <latexit sha1_base64="faJ5eHrwtQ7ihADjNg1ukcJYv/8=">AAACHXicbVDLSsNAFJ3UV62vqEs3g0VwISVpi4+FUHTTZQX7gCYNk+mkHTqZpDMToYT8iBt/xY0LRVy4Ef/GpC2i1gMzHM65l3vvcUNGpTKMTy23tLyyupZfL2xsbm3v6Lt7LRlEApMmDlggOi6ShFFOmooqRjqhIMh3GWm7o+vMb98RIWnAb9UkJLaPBpx6FCOVSo5etXykhq4XjxN4CbtjxzyBY6ecfRW7F1sqCBNoUQ5ndW5cT3oVRy8aJWMKuEjMOSmCORqO/m71Axz5hCvMkJRd0wiVHSOhKGYkKViRJCHCIzQg3ZRy5BNpx9PrEniUKn3oBSJ9XMGp+rMjRr6UE99NK7Md5V8vE//zupHyzu2Y8jBShOPZIC9iUAUwiwr2qSBYsUlKEBY03RXiIRIIqzTQwjSEiwyn3ycvkla5ZFZK1ZtqsXY1jyMPDsAhOAYmOAM1UAcN0AQY3INH8AxetAftSXvV3malOW3esw9+Qfv4AmekoQg=</latexit> 1 2 3 H 2 Quaternion Product Unit Layer 1 q =[s , v ] q =[s , v ] Weighting Chained <latexit sha1_base64="skCmEW1j8iZiTSYoGF0hGgm/f9k=">AAACAnicbVDLSsNAFJ3UV62vqCtxM1gEF1ISLT4WQtGNywr2AWkIk+mkHTqZxJlJoYTixl9x40IRt36FO//GSVpErQcuHM65l3vv8WNGpbKsT6MwN7+wuFRcLq2srq1vmJtbTRklApMGjlgk2j6ShFFOGooqRtqxICj0GWn5g6vMbw2JkDTit2oUEzdEPU4DipHSkmfu3Hk2vICO9OxD2AmR6vtBOhx7tuuZZati5YCzxJ6SMpii7pkfnW6Ek5BwhRmS0rGtWLkpEopiRsalTiJJjPAA9YijKUchkW6avzCG+1rpwiASuriCufpzIkWhlKPQ153ZkfKvl4n/eU6igjM3pTxOFOF4sihIGFQRzPKAXSoIVmykCcKC6lsh7iOBsNKplfIQzjOcfL88S5pHFfu4Ur2plmuX0ziKYBfsgQNgg1NQA9egDhoAg3vwCJ7Bi/FgPBmvxtuktWBMZ7bBLxjvXzF4li4=</latexit> 1 1 1 <latexit sha1_base64="skCmEW1j8iZiTSYoGF0hGgm/f9k=">AAACAnicbVDLSsNAFJ3UV62vqCtxM1gEF1ISLT4WQtGNywr2AWkIk+mkHTqZxJlJoYTixl9x40IRt36FO//GSVpErQcuHM65l3vv8WNGpbKsT6MwN7+wuFRcLq2srq1vmJtbTRklApMGjlgk2j6ShFFOGooqRtqxICj0GWn5g6vMbw2JkDTit2oUEzdEPU4DipHSkmfu3Hk2vICO9OxD2AmR6vtBOhx7tuuZZati5YCzxJ6SMpii7pkfnW6Ek5BwhRmS0rGtWLkpEopiRsalTiJJjPAA9YijKUchkW6avzCG+1rpwiASuriCufpzIkWhlKPQ153ZkfKvl4n/eU6igjM3pTxOFOF4sihIGFQRzPKAXSoIVmykCcKC6lsh7iOBsNKplfIQzjOcfL88S5pHFfu4Ur2plmuX0ziKYBfsgQNgg1NQA9egDhoAg3vwCJ7Bi/FgPBmvxtuktWBMZ7bBLxjvXzF4li4=</latexit>