{"id":486495,"date":"2026-07-07T12:43:50","date_gmt":"2026-07-07T12:43:50","guid":{"rendered":"https:\/\/savepearlharbor.com\/?p=486495"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=486495","title":{"rendered":"\u041f\u043e\u0434\u0432\u043e\u0434\u043d\u044b\u0435 \u043a\u0430\u043c\u043d\u0438 Learned Motion Matching: \u043e\u043f\u044b\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438"},"content":{"rendered":"<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0410\u0432\u0442\u043e\u0440: \u0413\u0435\u043e\u0440\u0433\u0438\u0439 \u041c\u0430\u0440\u043a\u0435\u043b\u043e\u0432, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a Softellion<\/p>\n<p>\u0412 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 <a href=\"https:\/\/habr.com\/ru\/articles\/1034842\/\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0430\u0442\u044c\u0435 <\/a>\u044f \u0441\u0434\u0435\u043b\u0430\u043b \u043e\u0431\u0437\u043e\u0440 \u043d\u0430 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043c\u0435\u0442\u043e\u0434\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0435\u0439 \u0441 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f. \u041e\u0434\u043d\u0430\u043a\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0440\u044f\u0434 \u043d\u0435\u0440\u0430\u0441\u043a\u0440\u044b\u0442\u044b\u0445 \u043f\u0440\u0438\u0435\u043c\u043e\u0432, \u0431\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u043e\u0434\u0435\u043b\u044e\u0441\u044c \u043e\u043f\u044b\u0442\u043e\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 Learned Motion Matching.<\/p>\n<h2>\u041f\u0440\u0435\u0434\u0438\u0441\u043b\u043e\u0432\u0438\u0435<\/h2>\n<p>\u0412\u0441\u0435 \u0444\u043e\u0440\u043c\u0443\u043b\u044b \u0441\u043f\u0440\u0430\u0432\u0435\u0434\u043b\u0438\u0432\u044b \u0434\u043b\u044f \u043b\u0435\u0432\u043e\u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0435\u0439 (left\u2011handed) \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442:<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/ca\/ab\/c2\/caabc22856c628b23f661462fd31d74a.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/ca\/ab\/c2\/caabc22856c628b23f661462fd31d74a.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/ca\/ab\/c2\/caabc22856c628b23f661462fd31d74a.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u041a\u0432\u0430\u0442\u0435\u0440\u043d\u0438\u043e\u043d\u044b \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 <img decoding=\"async\" class=\"formula inline\" source=\"(x, y, z, w)\" alt=\"(x, y, z, w)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/3\/3e\/3ee\/3ee6c286bdb4abd761d98ed3b3b23816.svg\" width=\"72\" height=\"16\" data-width=\"9.853\" data-height=\"2.262\" data-vertical-align=\"-0.566\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/3\/3e\/3ee\/3ee6c286bdb4abd761d98ed3b3b23816.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/formulas\/3\/3e\/3ee\/3ee6c286bdb4abd761d98ed3b3b23816.svg 781w\" loading=\"lazy\" decode=\"async\"\/> (\u0441\u043a\u0430\u043b\u044f\u0440 \u043d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c \u043c\u0435\u0441\u0442\u0435)<\/p>\n<h2>Quaternion unroll<\/h2>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u0443\u0433\u043e\u043b \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u0434\u0432\u0443\u043c\u044f \u043a\u0432\u0430\u0442\u0435\u0440\u043d\u0438\u043e\u043d\u0430\u043c\u0438 <img decoding=\"async\" class=\"formula inline\" source=\"q\" alt=\"q\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/7\/76\/769\/7694f4a66316e53c8cdd9d9954bd611d.svg\" width=\"12\" height=\"12\" data-width=\"1.041\" data-height=\"1.439\" data-vertical-align=\"-0.439\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/7\/76\/769\/7694f4a66316e53c8cdd9d9954bd611d.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/formulas\/7\/76\/769\/7694f4a66316e53c8cdd9d9954bd611d.svg 781w\" loading=\"lazy\" decode=\"async\"\/> \u0438 <img decoding=\"async\" class=\"formula inline\" source=\"-q\" alt=\"-q\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/c\/c9\/c9b\/c9bdc6de2a2cc7f67be9d7de97f44930.svg\" width=\"16\" height=\"12\" data-width=\"2.801\" data-height=\"1.758\" data-vertical-align=\"-0.439\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/c\/c9\/c9b\/c9bdc6de2a2cc7f67be9d7de97f44930.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/formulas\/c\/c9\/c9b\/c9bdc6de2a2cc7f67be9d7de97f44930.svg 781w\" loading=\"lazy\" decode=\"async\"\/>, \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0442\u0430\u043a, \u0447\u0442\u043e \u043f\u043e\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0441\u0438\u043b\u044c\u043d\u044b\u0435 \u0440\u0430\u0437\u0440\u044b\u0432\u044b \u0432 \u0434\u0430\u043d\u043d\u044b\u0445 (-179 \u0438 + 181 \u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0442 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0439 \u043f\u043e\u0432\u043e\u0440\u043e\u0442) \u0438 \u043e\u0434\u043d\u0430 \u0438 \u0442\u0430 \u0436\u0435 \u043f\u043e\u0437\u0430 (\u0438\u043b\u0438 \u043f\u043e\u0445\u043e\u0436\u0438\u0435) \u043a\u043e\u0434\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043f\u043e-\u0440\u0430\u0437\u043d\u043e\u043c\u0443. \u041f\u0440\u0438 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0438 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u044d\u0442\u043e \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u0442\u0435\u0440\u044f\u0435\u0442 \u0432\u0441\u044f\u043a\u0438\u0439 \u0441\u043c\u044b\u0441\u043b, \u0438 \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u0438 \u0442\u0430\u043a\u0438\u0445 \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u043f\u043e\u043b\u043e\u0436\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0442\u0430\u043a\u0436\u0435 \u043d\u0435 \u0432\u044b\u0439\u0434\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u0445\u043e\u0440\u043e\u0448\u0435\u0433\u043e.\u00a0\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0440\u0430\u0437\u0432\u043e\u0440\u043e\u0442 \u043a\u0432\u0430\u0442\u0435\u0440\u043d\u0438\u043e\u043d\u0430:<\/p>\n<pre><code class=\"python\">def unroll(x):   y = x.clone()   for i in range(1, len(x)):       d0 = torch.sum( y[i] * y[i-1], dim=-1)       d1 = torch.sum(-y[i] * y[i-1], dim=-1)       y[i][d0 &lt; d1] = -y[i][d0 &lt; d1]         return y<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:87px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0421\u0443\u0442\u044c \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e, \u0435\u0441\u043b\u0438 \u0441\u043a\u0430\u043b\u044f\u0440\u043d\u043e\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0441 \u043a\u0432\u0430\u0442\u0435\u0440\u043d\u0438\u043e\u043d\u043e\u043c \u0441 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u043a\u0430\u0434\u0440\u0430 \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435, \u0442\u043e \u0435\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c. \u0412 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0430 \u043f\u0440\u043e\u0442\u044f\u0436\u0435\u043d\u0438\u0438 \u0432\u0441\u0435\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0431\u043b\u044e\u0434\u0430\u0442\u044c\u0441\u044f \u0443\u0441\u043b\u043e\u0432\u0438\u0435 <img decoding=\"async\" class=\"formula inline\" source=\"q_i\u22c5q_{i\u22121} \u2265 0\" alt=\"q_i\u22c5q_{i\u22121} \u2265 0\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/2\/2c\/2c3\/2c332b443e804d6dfd8a790b6da52500.svg\" width=\"88\" height=\"12\" data-width=\"11.325\" data-height=\"1.977\" data-vertical-align=\"-0.471\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/2\/2c\/2c3\/2c332b443e804d6dfd8a790b6da52500.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/formulas\/2\/2c\/2c3\/2c332b443e804d6dfd8a790b6da52500.svg 781w\" loading=\"lazy\" decode=\"async\"\/>.<\/p>\n<p>\u041d\u0430\u0433\u043b\u044f\u0434\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u043a\u0432\u0430\u0442\u0435\u0440\u043d\u0438\u043e\u043d\u0430 \u0434\u043e \u0438 \u043f\u043e\u0441\u043b\u0435 \u0440\u0430\u0437\u0432\u043e\u0440\u043e\u0442\u0430:<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/cf\/c4\/3c\/cfc43c49b061e46326e8f72573367540.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/cf\/c4\/3c\/cfc43c49b061e46326e8f72573367540.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/cf\/c4\/3c\/cfc43c49b061e46326e8f72573367540.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/17\/a2\/f2\/17a2f20e9fc0e43344a28887e1aa42af.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/17\/a2\/f2\/17a2f20e9fc0e43344a28887e1aa42af.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/17\/a2\/f2\/17a2f20e9fc0e43344a28887e1aa42af.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0440\u0430\u0437\u0432\u043e\u0440\u043e\u0442\u0430 \u043a\u0432\u0430\u0442\u0435\u0440\u043d\u0438\u043e\u043d\u043e\u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0432\u0430\u0436\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0439 \u0438\u0441\u043a\u0443\u0441\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u043a\u043e\u0441\u0442\u0438, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0435\u0439 \u0442\u0440\u0430\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f\u00a0\u2014 root transformation.<\/p>\n<h2>Root transformation<\/h2>\n<p>\u042d\u0442\u0430 \u043a\u043e\u0441\u0442\u044c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u043d\u0430 \u0432\u0440\u0443\u0447\u043d\u0443\u044e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0432 Blender, \u0442\u0430\u043a \u0438 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u043d\u043e, \u043d\u043e \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u043b\u0436\u043d\u0430 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u00a0\u2014 \u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u0435\u0441\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u041f\u0440\u0438 \u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0432\u0430\u0436\u043d\u043e \u043f\u043e\u043c\u043d\u0438\u0442\u044c, \u0447\u0442\u043e \u043e\u043d\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0430. \u041f\u043e\u0441\u043b\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u0434\u043b\u044f \u0432\u0441\u0435\u0433\u043e \u0441\u043a\u0435\u043b\u0435\u0442\u0430. \u041f\u043e\u0437\u0438\u0446\u0438\u044f \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0442\u0430\u043a: \u043f\u0440\u043e\u0435\u0446\u0438\u0440\u0443\u0435\u043c \u0432\u0435\u0440\u0445\u043d\u044e\u044e \u043a\u043e\u0441\u0442\u044c \u043f\u043e\u0437\u0432\u043e\u043d\u043e\u0447\u043d\u0438\u043a\u0430 \u043d\u0430 \u0437\u0435\u043c\u043b\u044e \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u044e\u0449\u0438\u0439 \u0444\u0438\u043b\u044c\u0442\u0440 \u0421\u0430\u0432\u0438\u0446\u043a\u043e\u0433\u043e-\u0413\u043e\u043b\u0435\u044f:<\/p>\n<pre><code class=\"python\">from scipy import ndimage, signalg_pos, g_rot = quat_utils.fk(y_pos, y_rot, parents) # forward kinematicssim_bone_pos = torch.from_numpy(    signal.savgol_filter(g_pos[:, spine_node_id] * torch.tensor((1.0, 1.0, 0.0)),                          31, 3, axis=0, mode='interp'))<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041d\u0430 \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0435 \u0441\u043e \u0441\u043f\u043e\u043a\u043e\u0439\u043d\u043e\u0439 \u0445\u043e\u0434\u044c\u0431\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0439 \u0444\u0438\u043b\u044c\u0442\u0440 \u043c\u043e\u0436\u0435\u0442 \u0434\u0430\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u0432 ~0.6 \u043c\u0435\u0442\u0440\u0430 \u043c\u0435\u0436\u0434\u0443 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0439 \u0438 \u0441\u0433\u043b\u0430\u0436\u0435\u043d\u043d\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0435\u0439, \u0447\u0442\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0432\u043d\u0443\u0448\u0438\u0442\u0435\u043b\u044c\u043d\u043e.<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/7f\/a0\/f7\/7fa0f7404dfc5c0ea68f9002dbd88f77.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/7f\/a0\/f7\/7fa0f7404dfc5c0ea68f9002dbd88f77.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/7f\/a0\/f7\/7fa0f7404dfc5c0ea68f9002dbd88f77.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u0417\u0430\u0442\u0435\u043c \u0431\u0435\u0440\u0435\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u00ab\u0432\u043f\u0435\u0440\u0435\u0434\u00bb \u043a\u043e\u0441\u0442\u0438 \u0431\u0435\u0434\u0440\u0430, \u043f\u0440\u043e\u0435\u0446\u0438\u0440\u0443\u0435\u043c \u043d\u0430 \u0437\u0435\u043c\u043b\u044e \u0438 \u0442\u0430\u043a\u0436\u0435 \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u0435\u043c \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u043c. \u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0432\u043e \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u0432\u043e\u043a\u0440\u0443\u0433 \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043e\u0441\u0438\u00a0\u2014 \u0442\u0430\u043a \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a\u043e\u0441\u0442\u0438. \u0422\u0430\u043a\u0436\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u0444\u0438\u043b\u044c\u0442\u0440 \u0421\u0430\u0432\u0438\u0446\u043a\u043e\u0433\u043e-\u0413\u043e\u043b\u0435\u044f:<\/p>\n<pre><code class=\"python\"># direction taken from projected hip forward direction# 0.0, 0.0, 1.0 is local up axissim_bone_dir = (torch.tensor((1.0, 1.0, 0.0)) *                    quat_utils.mul_vec(g_rot[:, hips_node_id:hips_node_id+1],                                        torch.tensor((0.0, 0.0, 1.0)).unsqueeze(0).unsqueeze(0))                    )sim_bone_dir = quat_utils.normalize(sim_bone_dir)sim_bone_dir = torch.from_numpy(signal.savgol_filter(sim_bone_dir, 61, 3, axis=0, mode='interp'))sim_bone_dir = quat_utils.normalize(sim_bone_dir)sim_bone_rot = quat_utils.normalize(        quat_utils.between(torch.tensor([1.0, 0.0, 0.0]).unsqueeze(0).unsqueeze(0), sim_bone_dir)    ).squeeze(1)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u043a\u0432\u0430\u0442\u0435\u0440\u043d\u0438\u043e\u043d\u044b \u043f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043d\u0430\u0437\u043d\u0430\u0447\u0430\u0435\u043c \u043d\u043e\u0432\u0443\u044e \u043a\u043e\u0441\u0442\u044c \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u0434\u043b\u044f \u0432\u0441\u0435\u0433\u043e \u0441\u043a\u0435\u043b\u0435\u0442\u0430 \u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0432\u0441\u0435\u0445 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u043a\u043e\u0441\u0442\u0435\u0439 \u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u043d\u043e\u0432\u043e\u0439 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438, \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u044f \u0442\u0430\u043a\u0436\u0435 \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0438 \u0441\u0430\u043c\u0443 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044e:<\/p>\n<pre><code class=\"python\"># Transform first joint to be local to sim and append sim as root boney_pos[:, 0] = quat_utils.inv_mul_vec(sim_bone_rot, y_pos[:, 0] - sim_bone_pos)y_rot[:, 0] = quat_utils.inv_mul(sim_bone_rot, y_rot[:, 0])y_pos = torch.concat([sim_bone_pos.unsqueeze(1), y_pos], dim=1)y_rot = torch.concat([sim_bone_rot.unsqueeze(1), y_rot], dim=1)parents = torch.concat([torch.tensor((-1,)), parents + 1])<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0439 \u043a\u043e\u0441\u0442\u0438 \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u0434\u0430\u0447\u0430 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0435\u0439 \u0432\u0441\u0435\u0445 \u043a\u043e\u0441\u0442\u0435\u0439 \u0441\u043a\u0435\u043b\u0435\u0442\u0430.  <\/p>\n<h2>\u0421\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043a\u043e\u0441\u0442\u0435\u0439<\/h2>\n<p>\u0421\u0438\u043b\u044c\u043d\u044b\u0435 \u0432\u044b\u0431\u0440\u043e\u0441\u044b \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u043a \u0434\u0440\u043e\u0436\u0430\u043d\u0438\u044e \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443, \u0445\u043e\u0442\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0438 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u043f\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u0443\u043b\u0435, \u0434\u043b\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0441\u0438\u043b\u044c\u043d\u044b\u0445 \u0432\u0441\u043f\u043b\u0435\u0441\u043a\u043e\u0432 \u043b\u0443\u0447\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u044e \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u043e\u0439 \u0440\u0430\u0437\u043d\u043e\u0441\u0442\u0438 (central difference) <img decoding=\"async\" class=\"formula inline\" source=\"v_i=(x_{i+1}\u2212x_{i\u22121}) \/ 2h\" alt=\"v_i=(x_{i+1}\u2212x_{i\u22121}) \/ 2h\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/3\/30\/309\/309086a4e8de588e6165661a4dc437cc.svg\" width=\"168\" height=\"16\" data-width=\"21.102\" data-height=\"2.262\" data-vertical-align=\"-0.566\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/3\/30\/309\/309086a4e8de588e6165661a4dc437cc.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/formulas\/3\/30\/309\/309086a4e8de588e6165661a4dc437cc.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<pre><code class=\"python\">vel[1:-1] = (pos[2:] - pos[1:-1] +            pos[1:-1] - pos[:-2]) * 0.5 * fpsvel[0] = vel[1] - (vel[3] - vel[2])vel[-1] = vel[-2] + (vel[-2] - vel[-3])<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041c\u0435\u0442\u043e\u0434 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u043e\u0435 \u043e\u043a\u043d\u043e \u0432\u043e\u043a\u0440\u0443\u0433 \u043e\u0434\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0438. \u042d\u0442\u043e \u0434\u0430\u0435\u0442 \u0442\u0440\u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0430:<\/p>\n<ul>\n<li>\n<p>\u0448\u0443\u043c\u044b \u0438 \u0441\u043a\u0430\u0447\u043a\u0438 \u0432 \u043e\u0434\u043d\u043e\u043c \u043a\u0430\u0434\u0440\u0435 \u043a\u043e\u043c\u043f\u0435\u043d\u0441\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u043c\u0438 \u043a\u0430\u0434\u0440\u0430\u043c\u0438;<\/p>\n<\/li>\n<li>\n<p>\u043e\u0446\u0435\u043d\u043a\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0430 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 <img decoding=\"async\" class=\"formula inline\" source=\"O(h^2)\" alt=\"O(h^2)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/2\/2a\/2a6\/2a67626253be046f40c7650f783b6089.svg\" width=\"40\" height=\"16\" data-width=\"5.777\" data-height=\"2.565\" data-vertical-align=\"-0.566\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/2\/2a\/2a6\/2a67626253be046f40c7650f783b6089.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/formulas\/2\/2a\/2a6\/2a67626253be046f40c7650f783b6089.svg 781w\" loading=\"lazy\" decode=\"async\"\/>, \u0430 \u043d\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e, \u043a\u0430\u043a \u0432 forward\/backward difference;<\/p>\n<\/li>\n<li>\n<p>\u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u0433\u043b\u0430\u0434\u043a\u043e\u0439 \u0438 \u043c\u0435\u043d\u0435\u0435 \u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043a \u0435\u0434\u0438\u043d\u0438\u0447\u043d\u044b\u043c \u0432\u044b\u0431\u0440\u043e\u0441\u0430\u043c;<\/p>\n<\/li>\n<\/ul>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0432\u044b\u0431\u0440\u043e\u0441\u044b \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435 \u043d\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f\u00a0\u2014 \u0441\u043d\u0438\u0436\u0430\u0435\u0442\u0441\u044f \u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043a \u0448\u0443\u043c\u0443.<\/p>\n<p>\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u044e\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0442\u043e\u0447\u043a\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0439 \u044d\u043a\u0441\u0442\u0440\u0430\u043f\u043e\u043b\u044f\u0446\u0438\u0438, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e, \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0442\u0430\u043c \u043d\u0435\u0442 \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u0445 \u0442\u043e\u0447\u0435\u043a \u0441 \u043e\u0431\u0435\u0438\u0445 \u0441\u0442\u043e\u0440\u043e\u043d.<\/p>\n<p>\u0420\u0430\u0437\u043e\u0431\u0440\u0430\u0432\u0448\u0438\u0441\u044c \u0441 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435\u043c \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438, \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u0447\u0435\u0440\u0435\u0434 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a\u043e\u0441\u0442\u0435\u0439 \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0430 \u043d\u043e\u0433 \u0441 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c\u044e.<\/p>\n<h2>2-column rotation matrix<\/h2>\n<p>\u041a\u0430\u043a \u0431\u044b\u043b\u043e \u0441\u043a\u0430\u0437\u0430\u043d\u043e \u0440\u0430\u043d\u0435\u0435 (\u0441\u043c. quaternion unroll), \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u043d\u0438\u0435 \u043a\u0432\u0430\u0442\u0435\u0440\u043d\u0438\u043e\u043d\u043e\u0432 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c\u044e \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a\u043e\u0441\u0442\u0435\u0439 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0438 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432 \u0432\u0438\u0434\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0432\u0435\u043a\u0442\u043e\u0440\u043e\u0432 \u00ab\u0432\u043f\u0435\u0440\u0435\u0434\u00bb \u0438 \u00ab\u0432\u0432\u0435\u0440\u0445\u00bb.<\/p>\n<pre><code class=\"python\">def to_xform_xz(x):   qx, qy, qz, qw = x[..., 0:1], x[..., 1:2], x[..., 2:3], x[..., 3:4]   x2, y2, z2 = qx + qx, qy + qy, qz + qz   # Precompute products for the rotation matrix   xx, yy, wx = qx * x2, qy * y2, qw * x2   xy, yz, wy = qx * y2, qy * z2, qw * y2   xz, zz, wz = qx * z2, qz * z2, qw * z2   return torch.concatenate([       torch.concatenate([1.0 - (yy + zz), xz + wy], dim=-1)[..., torch.newaxis, :],       torch.concatenate([xy + wz, yz - wx], dim=-1)[..., torch.newaxis, :],       torch.concatenate([xz - wy, 1.0 - (xx + yy)], dim=-1)[..., torch.newaxis, :],   ], dim=-2)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<h2>\u041a\u043e\u043d\u0442\u0430\u043a\u0442 \u043d\u043e\u0433 \u0441 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c\u044e<\/h2>\n<p>\u041c\u043e\u0436\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0441 \u0437\u0430\u0434\u0430\u043d\u0438\u0435\u043c \u043f\u043e\u0440\u043e\u0433\u043e\u0432\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u00a0\u2014 \u0435\u0441\u043b\u0438 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043d\u0438\u0436\u0435, \u0442\u043e \u0441\u0447\u0438\u0442\u0430\u0435\u043c, \u0447\u0442\u043e \u043d\u043e\u0433\u0430 \u0441\u0442\u043e\u0438\u0442 \u043d\u0430 \u043c\u0435\u0441\u0442\u0435. L2-\u043d\u043e\u0440\u043c\u0430 3D \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0441\u0432\u043e\u0434\u0438\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a \u0441\u043a\u0430\u043b\u044f\u0440\u0443. \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043c\u0435\u0434\u0438\u0430\u043d\u043d\u044b\u0439 \u0444\u0438\u043b\u044c\u0442\u0440 \u0434\u043b\u044f \u0443\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0445 \u00ab\u043e\u043a\u043e\u043d\u00bb (\u043b\u043e\u0436\u043d\u044b\u0445 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u0439):<\/p>\n<pre><code class=\"python\">contact_velocity_threshold = 0.15 * 100  # to cm# L2 norm of 3D velocity collapses all motion into single scalar speedcontact_velocity = torch.norm(g_vel[:, [left_toe_id, right_toe_id]], dim=-1)extra = contact_velocity &lt; contact_velocity_thresholdfor ci in range(extra.shape[1]):   extra[:, ci] = torch.from_numpy(ndimage.median_filter(extra[:, ci], size=6, mode='nearest'))<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0440\u0430\u0431\u043e\u0442\u044b \u0444\u0438\u043b\u044c\u0442\u0440\u0430:<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/d9\/94\/d3\/d994d310e00c39855493838f9038218f.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/d9\/94\/d3\/d994d310e00c39855493838f9038218f.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/d9\/94\/d3\/d994d310e00c39855493838f9038218f.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u0430\u0443\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u0434 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u043e\u0439 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0435\u0439 \u0432\u044b\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0440\u0430\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f.<\/p>\n<h2>\u0422\u0440\u0430\u0435\u043a\u0442\u043e\u0440\u0438\u044f \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f<\/h2>\n<p>\u0422\u0440\u0430\u0435\u043a\u0442\u043e\u0440\u0438\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u0447\u043a\u0430\u0445 20, 40, 60 \u043a\u0430\u0434\u0440\u043e\u0432 \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0447\u0435\u0441\u0442\u044c \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u0435 \u0440\u043e\u043b\u0438\u043a\u0430 \u0438 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0435\u0433\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c:<\/p>\n<pre><code class=\"python\">def clamp_frame(frame, offset):   for i in range(len(range_starts)):       if range_starts[i] &lt;= frame &lt; range_stops[i]:           return min(max(frame + offset, range_starts[i].item()), range_stops[i].item() - 1)for i in range(start, stop):   future_frame_20 = clamp_frame(i, 20)   future_frame_40 = clamp_frame(i, 40)   future_frame_60 = clamp_frame(i, 60)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0422\u0430\u043a, \u043f\u043e \u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0435\u043d\u0438\u044e \u043a \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044e \u0440\u043e\u043b\u0438\u043a\u0430, \u043c\u044b \u043f\u043b\u0430\u0432\u043d\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u043c \u0431\u0443\u0434\u0443\u0449\u0438\u0439 \u043a\u0430\u0434\u0440 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c.<\/p>\n<p>\u041f\u043e\u0437\u0438\u0446\u0438\u0438 \u0438 \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u0442\u0440\u0430\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u0430\u043a \u0440\u0430\u0437\u043d\u043e\u0441\u0442\u044c, \u043e\u0434\u043d\u0430\u043a\u043e, \u0435\u0441\u043b\u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u043c\u043d\u043e\u0436\u0438\u0442\u044c \u043d\u0430 \u043e\u0431\u0440\u0430\u0442\u043d\u044b\u0439 \u043a\u0432\u0430\u0442\u0435\u0440\u043d\u0438\u043e\u043d Root transformation, \u0442\u043e \u043c\u044b \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0435\u043c \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0430 \u0442\u0430\u043a, \u0447\u0442\u043e \u043e\u043d \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u043a\u0430\u0434\u0440\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432\u0441\u0435\u0433\u0434\u0430 \u0432 \u043e\u0434\u043d\u043e\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0434\u043e\u0441\u0442\u0438\u0433\u0430\u0435\u0442\u0441\u044f \u0438\u043d\u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043d\u043e\u0441\u0442\u044c \u043f\u043e \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044e \u043a \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044e \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f.<\/p>\n<pre><code class=\"python\">traj_pos_20 = quat_utils.inv_mul_vec(y_rot[i, 0], y_pos[future_frame_20, 0] - y_pos[i, 0])traj_pos_40 = quat_utils.inv_mul_vec(y_rot[i, 0], y_pos[future_frame_40, 0] - y_pos[i, 0])traj_pos_60 = quat_utils.inv_mul_vec(y_rot[i, 0], y_pos[future_frame_60, 0] - y_pos[i, 0])# Rotate the local forward vector (1.0, 0.0, 0.0) because X is forward to get world-space forwardtraj_dir_20 = quat_utils.inv_mul_vec(y_rot[i, 0], quat_utils.mul_vec(y_rot[future_frame_20, 0], torch.tensor((1.0, 0.0, 0.0))))traj_dir_40 = quat_utils.inv_mul_vec(y_rot[i, 0], quat_utils.mul_vec(y_rot[future_frame_40, 0], torch.tensor((1.0, 0.0, 0.0))))traj_dir_60 = quat_utils.inv_mul_vec(y_rot[i, 0], quat_utils.mul_vec(y_rot[future_frame_60, 0], torch.tensor((1.0, 0.0, 0.0))))<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0422\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0437\u0438\u0446\u0438\u0439 \u0438 \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0439 \u043a\u043e\u0441\u0442\u0435\u0439, \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0432 \u043d\u0430\u0431\u043e\u0440 \u0434\u043b\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043f\u043e\u0437\u044b (features):<\/p>\n<pre><code class=\"python\">left_foot_pos = quat_utils.inv_mul_vec(rot[:, 0], g_pos[:, left_foot_id] - g_pos[:, 0])right_foot_pos = quat_utils.inv_mul_vec(rot[:, 0], g_pos[:, right_foot_id] - g_pos[:, 0])left_foot_vel = quat_utils.inv_mul_vec(rot[:, 0], g_vel[:, left_foot_id])right_foot_vel = quat_utils.inv_mul_vec(rot[:, 0], g_vel[:, right_foot_id])hips_vel = quat_utils.inv_mul_vec(rot[:, 0], g_vel[:, hips_node_id])<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041d\u0430 \u044d\u0442\u043e \u0430\u0443\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f.<\/p>\n<h2>Projector nearest neighbor search<\/h2>\n<p>\u041d\u0430\u043f\u043e\u043c\u043d\u044e, \u0447\u0442\u043e \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c Projector \u044d\u043c\u0443\u043b\u0438\u0440\u0443\u0435\u0442 \u043f\u043e\u0438\u0441\u043a \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0435\u0433\u043e \u0441\u043e\u0441\u0435\u0434\u0430 \u0434\u043b\u044f <img decoding=\"async\" class=\"formula inline\" source=\"x\" alt=\"x\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/9\/9d\/9dd\/9dd4e461268c8034f5c8564e155c67a6.svg\" width=\"12\" height=\"12\" data-width=\"1.294\" data-height=\"1.025\" data-vertical-align=\"-0.025\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/9\/9d\/9dd\/9dd4e461268c8034f5c8564e155c67a6.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/formulas\/9\/9d\/9dd\/9dd4e461268c8034f5c8564e155c67a6.svg 781w\" loading=\"lazy\" decode=\"async\"\/>. \u0417\u0430\u0434\u0430\u0447\u0430 \u0441\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044e \u0435\u0432\u043a\u043b\u0438\u0434\u043e\u0432\u043e\u0433\u043e \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0435\u043c\u043a\u043e\u0439, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u0441\u0435\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430.<\/p>\n<p><img decoding=\"async\" class=\"formula inline\" source=\"d(p,q) = \\sqrt{(p_1 - q_1)^2 + (p_2 - q_2)^2 + \\ldots + (p_n - q_n)^2} = \\sqrt{\\sum_{k=1}^n(p_k - q_k)^2 }\" alt=\"d(p,q) = \\sqrt{(p_1 - q_1)^2 + (p_2 - q_2)^2 + \\ldots + (p_n - q_n)^2} = \\sqrt{\\sum_{k=1}^n(p_k - q_k)^2 }\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/3\/32\/32b\/32b6ed16b8c3314ce6385f055c122bc3.svg\" width=\"552\" height=\"64\" data-width=\"69.999\" data-height=\"8.281\" data-vertical-align=\"-3.575\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/3\/32\/32b\/32b6ed16b8c3314ce6385f055c122bc3.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/formulas\/3\/32\/32b\/32b6ed16b8c3314ce6385f055c122bc3.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p>\u0414\u043b\u044f \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 sklearn.neighbors.BallTree:<\/p>\n<pre><code class=\"python\">from sklearn.neighbors import BallTreetree = BallTree(x)nearest = tree.query(x_hat, k=1, return_distance=False)[:, 0]<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, faiss, \u043e\u043d \u0434\u0430\u0441\u0442 \u0435\u0449\u0435 \u0431\u043e\u043b\u044c\u0448\u0438\u0439 \u043f\u0440\u0438\u0440\u043e\u0441\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u043d\u043e \u0438 \u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043d\u0435 \u0442\u0430\u043a\u043e\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0435, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0435\u0442 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 Windows.<\/p>\n<h2>\u0421\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0438 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439<\/h2>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0435\u0439 LMM \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0437\u0430\u0434\u0430\u0447\u0430 \u0438\u0445 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0432 \u043a\u043e\u043d\u0435\u0447\u043d\u0443\u044e \u0441\u0440\u0435\u0434\u0443. \u0412\u0430\u0436\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0444\u043e\u0440\u043c\u0430\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0443\u0434\u043e\u0431\u0435\u043d \u0434\u043b\u044f \u0438\u043d\u0444\u0435\u0440\u0435\u043d\u0441\u0430 \u0438 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c \u0441 \u0434\u0432\u0438\u0436\u043a\u043e\u043c.<\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u0435\u0441\u0442\u044c 2 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u0440\u0435\u0448\u0435\u043d\u0438\u044f:<\/p>\n<ol>\n<li>\n<p>\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 ONNX<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0432\u0435\u0441\u0430 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u043b\u043e\u044f \u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 (\u0421\u041a\u041e \u0438 \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435) \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442<\/p>\n<\/li>\n<\/ol>\n<p>ONNX \u0443\u0434\u043e\u0431\u0435\u043d \u0442\u0435\u043c, \u0447\u0442\u043e, \u0435\u0441\u043b\u0438 \u043a\u043e\u043d\u0435\u0447\u043d\u0430\u044f \u0441\u0440\u0435\u0434\u0430 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0438\u043d\u0444\u0435\u0440\u0435\u043d\u0441\u0430 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0432 \u0442\u0430\u043a\u043e\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435, \u0442\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0434\u0435\u043b\u0430\u0442\u044c. \u0412\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u0436\u0435 \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0434\u0430\u043d\u043d\u044b\u0445, \u043c\u0430\u0442\u0440\u0438\u0447\u043d\u043e\u0435 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 (ReLU \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 LMM) \u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e.<\/p>\n<p>\u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 ONNX &#8212; \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0439 \u0441\u0440\u0435\u0434\u043e\u0439 ONNX opset version \u0438 opset_version, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u043f\u0440\u0438 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u0432 \u044d\u0442\u043e\u0442 \u0444\u043e\u0440\u043c\u0430\u0442.<\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0440\u0430\u0431\u043e\u0447\u0435\u0439 \u0441\u0440\u0435\u0434\u044b \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 LMM \u0431\u044b\u043b\u043e \u0440\u0435\u0448\u0435\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Unreal Engine 5, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u043c\u0435\u0435\u0442 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0438\u043d\u0444\u0435\u0440\u0435\u043d\u0441\u0430 ONNX \u043c\u043e\u0434\u0435\u043b\u0435\u0439 &#8212; UNNERuntime. \u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043d\u0438\u043c \u043d\u0443\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c \u0438 \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0432\u0445\u043e\u0434\u043d\u044b\u0435\/\u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435.<\/p>\n<p>\u0421\u0430\u043c \u044d\u043a\u0441\u043f\u043e\u0440\u0442 \u0432 ONNX \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u043e, \u043d\u0443\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435 \u0437\u0430\u0431\u044b\u0442\u044c \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c \u0432 \u0440\u0435\u0436\u0438\u043c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0438 \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u044b:<\/p>\n<pre><code class=\"python\">compressor.eval()with torch.no_grad():   input = (torch.cat([           y_pos[:, 1:].reshape([num_frames, -1]),           y_txz[:, 1:].reshape([num_frames, -1]),           y_vel[:, 1:].reshape([num_frames, -1]),           y_ang[:, 1:].reshape([num_frames, -1]),           q_pos[:, 1:].reshape([num_frames, -1]),           q_txz[:, 1:].reshape([num_frames, -1]),           q_vel[:, 1:].reshape([num_frames, -1]),           q_ang[:, 1:].reshape([num_frames, -1]),           y_root_vel.reshape([num_frames, -1]),           y_root_ang.reshape([num_frames, -1]),           y_extra.reshape([num_frames, -1]),       ], dim=-1) - compressor_mean_in) \/ compressor_std_in   z = compressor(input.to(device))torch.save(z.detach().cpu(), root_dir \/ 'z.pt')torch.onnx.export(   compressor,   (compressor_mean_in,),   f\"{root_dir}\/compressor.onnx\",   input_names=[\"y_q\"],   output_names=[\"z\"],   dynamo=True)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0438 \u0434\u043b\u044f \u0434\u0440\u0443\u0433\u0438\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0437\u0430 \u0442\u0435\u043c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c, \u0447\u0442\u043e \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u043d\u0438\u043a\u0430\u043a\u0438\u0435 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u043c\u043e\u0434\u0435\u043b\u044c \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0430, \u0435\u0451 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0432 UE5 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0438\u043d\u0444\u0435\u0440\u0435\u043d\u0441.<\/p>\n<p>\u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u043d\u0444\u0435\u0440\u0435\u043d\u0441\u0430 \u043c\u043e\u0434\u0435\u043b\u0438 Decompressor:<\/p>\n<pre><code class=\"cpp\">bool NNModels::RunDecompressorModel(TArray&lt;float&gt;&amp; features, TArray&lt;float&gt;&amp; latent) {   if (DecompressorModel.IsValid() == false || InputBindings.Num() == 0) {      return false;   }   TArray&lt;float&gt; input;   input.SetNumZeroed(features.Num() + latent.Num());   for (int i = 0; i &lt; features.Num(); i++) {      input[i] = features[i];   }   for (int i = 0; i &lt; latent.Num(); i++) {      input[features.Num() + i] = latent[i];   }   InputBindings[0].Data = input.GetData();   InputBindings[0].SizeInBytes = input.Num() * sizeof(float);   OutputBindings[0].Data = DecompressorOutputData.GetData();   OutputBindings[0].SizeInBytes = DecompressorOutputData.Num() * sizeof(float);   return DecompressorModel-&gt;RunSync(InputBindings, OutputBindings) == UE::NNE::EResultStatus::Ok;}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u041f\u0440\u0438\u043c\u0435\u043d\u0438\u0432 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0435 \u0432\u044b\u0448\u0435 \u043f\u0440\u0438\u0435\u043c\u044b, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 Learned Motion Matching. \u041e\u0434\u043d\u0430\u043a\u043e \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u0441\u0447\u0438\u0442\u0430\u0442\u044c, \u0447\u0442\u043e \u043e\u043d\u0438 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432\u0435\u0440\u043d\u044b\u0435: \u0442\u0430\u043a, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u0438, \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f root transformation, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0442.\u0434.<\/p>\n<\/div>\n<p>\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/1056588\/\">https:\/\/habr.com\/ru\/articles\/1056588\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0410\u0432\u0442\u043e\u0440: \u0413\u0435\u043e\u0440\u0433\u0438\u0439 \u041c\u0430\u0440\u043a\u0435\u043b\u043e\u0432, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a Softellion\u0412 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0441\u0434\u0435\u043b\u0430\u043b \u043e\u0431\u0437\u043e\u0440 \u043d\u0430 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043c\u0435\u0442\u043e\u0434\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0435\u0439 \u0441 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f. \u041e\u0434\u043d\u0430\u043a\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0440\u044f\u0434 \u043d\u0435\u0440\u0430\u0441\u043a\u0440\u044b\u0442\u044b\u0445 \u043f\u0440\u0438\u0435\u043c\u043e\u0432, \u0431\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u043e\u0434\u0435\u043b\u044e\u0441\u044c \u043e\u043f\u044b\u0442\u043e\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 Learned Motion Matching.\u041f\u0440\u0435\u0434\u0438\u0441\u043b\u043e\u0432\u0438\u0435\u0412\u0441\u0435 \u0444\u043e\u0440\u043c\u0443\u043b\u044b \u0441\u043f\u0440\u0430\u0432\u0435\u0434\u043b\u0438\u0432\u044b \u0434\u043b\u044f \u043b\u0435\u0432\u043e\u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0435\u0439 (left\u2011handed) \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442:\u041a\u0432\u0430\u0442\u0435\u0440\u043d\u0438\u043e\u043d\u044b \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435  (\u0441\u043a\u0430\u043b\u044f\u0440 \u043d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c \u043c\u0435\u0441\u0442\u0435)Quaternion unroll\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u0443\u0433\u043e\u043b \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u0434\u0432\u0443\u043c\u044f \u043a\u0432\u0430\u0442\u0435\u0440\u043d\u0438\u043e\u043d\u0430\u043c\u0438  \u0438 , \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0442\u0430\u043a, \u0447\u0442\u043e \u043f\u043e\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0441\u0438\u043b\u044c\u043d\u044b\u0435 \u0440\u0430\u0437\u0440\u044b\u0432\u044b \u0432 \u0434\u0430\u043d\u043d\u044b\u0445 (-179 \u0438 + 181 \u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0442 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0439 \u043f\u043e\u0432\u043e\u0440\u043e\u0442) \u0438 \u043e\u0434\u043d\u0430 \u0438 \u0442\u0430 \u0436\u0435 \u043f\u043e\u0437\u0430 (\u0438\u043b\u0438 \u043f\u043e\u0445\u043e\u0436\u0438\u0435) \u043a\u043e\u0434\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043f\u043e-\u0440\u0430\u0437\u043d\u043e\u043c\u0443. \u041f\u0440\u0438 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0438 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u044d\u0442\u043e \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u0442\u0435\u0440\u044f\u0435\u0442 \u0432\u0441\u044f\u043a\u0438\u0439 \u0441\u043c\u044b\u0441\u043b, \u0438 \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u0438 \u0442\u0430\u043a\u0438\u0445 \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u043f\u043e\u043b\u043e\u0436\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0442\u0430\u043a\u0436\u0435 \u043d\u0435 \u0432\u044b\u0439\u0434\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u0445\u043e\u0440\u043e\u0448\u0435\u0433\u043e.\u00a0\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0440\u0430\u0437\u0432\u043e\u0440\u043e\u0442 \u043a\u0432\u0430\u0442\u0435\u0440\u043d\u0438\u043e\u043d\u0430:def unroll(x):   y = x.clone()   for i in range(1, len(x)):       d0 = torch.sum( y[i] * y[i-1], dim=-1)       d1 = torch.sum(-y[i] * y[i-1], dim=-1)       y[i][d0 &lt; d1] = -y[i][d0 &lt; d1]         return y\u0421\u0443\u0442\u044c \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e, \u0435\u0441\u043b\u0438 \u0441\u043a\u0430\u043b\u044f\u0440\u043d\u043e\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0441 \u043a\u0432\u0430\u0442\u0435\u0440\u043d\u0438\u043e\u043d\u043e\u043c \u0441 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u043a\u0430\u0434\u0440\u0430 \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435, \u0442\u043e \u0435\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c. \u0412 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0430 \u043f\u0440\u043e\u0442\u044f\u0436\u0435\u043d\u0438\u0438 \u0432\u0441\u0435\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0431\u043b\u044e\u0434\u0430\u0442\u044c\u0441\u044f \u0443\u0441\u043b\u043e\u0432\u0438\u0435 .\u041d\u0430\u0433\u043b\u044f\u0434\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u043a\u0432\u0430\u0442\u0435\u0440\u043d\u0438\u043e\u043d\u0430 \u0434\u043e \u0438 \u043f\u043e\u0441\u043b\u0435 \u0440\u0430\u0437\u0432\u043e\u0440\u043e\u0442\u0430:\u041f\u043e\u0441\u043b\u0435 \u0440\u0430\u0437\u0432\u043e\u0440\u043e\u0442\u0430 \u043a\u0432\u0430\u0442\u0435\u0440\u043d\u0438\u043e\u043d\u043e\u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0432\u0430\u0436\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0439 \u0438\u0441\u043a\u0443\u0441\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u043a\u043e\u0441\u0442\u0438, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0435\u0439 \u0442\u0440\u0430\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f\u00a0\u2014 root transformation.Root transformation\u042d\u0442\u0430 \u043a\u043e\u0441\u0442\u044c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u043d\u0430 \u0432\u0440\u0443\u0447\u043d\u0443\u044e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0432 Blender, \u0442\u0430\u043a \u0438 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u043d\u043e, \u043d\u043e \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u043b\u0436\u043d\u0430 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u00a0\u2014 \u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u0435\u0441\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u041f\u0440\u0438 \u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0432\u0430\u0436\u043d\u043e \u043f\u043e\u043c\u043d\u0438\u0442\u044c, \u0447\u0442\u043e \u043e\u043d\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0430. \u041f\u043e\u0441\u043b\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u0434\u043b\u044f \u0432\u0441\u0435\u0433\u043e \u0441\u043a\u0435\u043b\u0435\u0442\u0430. \u041f\u043e\u0437\u0438\u0446\u0438\u044f \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0442\u0430\u043a: \u043f\u0440\u043e\u0435\u0446\u0438\u0440\u0443\u0435\u043c \u0432\u0435\u0440\u0445\u043d\u044e\u044e \u043a\u043e\u0441\u0442\u044c \u043f\u043e\u0437\u0432\u043e\u043d\u043e\u0447\u043d\u0438\u043a\u0430 \u043d\u0430 \u0437\u0435\u043c\u043b\u044e \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u044e\u0449\u0438\u0439 \u0444\u0438\u043b\u044c\u0442\u0440 \u0421\u0430\u0432\u0438\u0446\u043a\u043e\u0433\u043e-\u0413\u043e\u043b\u0435\u044f:from scipy import ndimage, signalg_pos, g_rot = quat_utils.fk(y_pos, y_rot, parents) # forward kinematicssim_bone_pos = torch.from_numpy(    signal.savgol_filter(g_pos[:, spine_node_id] * torch.tensor((1.0, 1.0, 0.0)),                          31, 3, axis=0, mode=&#8217;interp&#8217;))\u041d\u0430 \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0435 \u0441\u043e \u0441\u043f\u043e\u043a\u043e\u0439\u043d\u043e\u0439 \u0445\u043e\u0434\u044c\u0431\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0439 \u0444\u0438\u043b\u044c\u0442\u0440 \u043c\u043e\u0436\u0435\u0442 \u0434\u0430\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u0432 ~0.6 \u043c\u0435\u0442\u0440\u0430 \u043c\u0435\u0436\u0434\u0443 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0439 \u0438 \u0441\u0433\u043b\u0430\u0436\u0435\u043d\u043d\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0435\u0439, \u0447\u0442\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0432\u043d\u0443\u0448\u0438\u0442\u0435\u043b\u044c\u043d\u043e.\u0417\u0430\u0442\u0435\u043c \u0431\u0435\u0440\u0435\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u00ab\u0432\u043f\u0435\u0440\u0435\u0434\u00bb \u043a\u043e\u0441\u0442\u0438 \u0431\u0435\u0434\u0440\u0430, \u043f\u0440\u043e\u0435\u0446\u0438\u0440\u0443\u0435\u043c \u043d\u0430 \u0437\u0435\u043c\u043b\u044e \u0438 \u0442\u0430\u043a\u0436\u0435 \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u0435\u043c \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u043c. \u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0432\u043e \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u0432\u043e\u043a\u0440\u0443\u0433 \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043e\u0441\u0438\u00a0\u2014 \u0442\u0430\u043a \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a\u043e\u0441\u0442\u0438. \u0422\u0430\u043a\u0436\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u0444\u0438\u043b\u044c\u0442\u0440 \u0421\u0430\u0432\u0438\u0446\u043a\u043e\u0433\u043e-\u0413\u043e\u043b\u0435\u044f:# direction taken from projected hip forward direction# 0.0, 0.0, 1.0 is local up axissim_bone_dir = (torch.tensor((1.0, 1.0, 0.0)) *                    quat_utils.mul_vec(g_rot[:, hips_node_id:hips_node_id+1],                                        torch.tensor((0.0, 0.0, 1.0)).unsqueeze(0).unsqueeze(0))                    )sim_bone_dir = quat_utils.normalize(sim_bone_dir)sim_bone_dir = torch.from_numpy(signal.savgol_filter(sim_bone_dir, 61, 3, axis=0, mode=&#8217;interp&#8217;))sim_bone_dir = quat_utils.normalize(sim_bone_dir)sim_bone_rot = quat_utils.normalize(        quat_utils.between(torch.tensor([1.0, 0.0, 0.0]).unsqueeze(0).unsqueeze(0), sim_bone_dir)    ).squeeze(1)\u041e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u043a\u0432\u0430\u0442\u0435\u0440\u043d\u0438\u043e\u043d\u044b \u043f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438.\u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043d\u0430\u0437\u043d\u0430\u0447\u0430\u0435\u043c \u043d\u043e\u0432\u0443\u044e \u043a\u043e\u0441\u0442\u044c \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u0434\u043b\u044f \u0432\u0441\u0435\u0433\u043e \u0441\u043a\u0435\u043b\u0435\u0442\u0430 \u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0432\u0441\u0435\u0445 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u043a\u043e\u0441\u0442\u0435\u0439 \u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u043d\u043e\u0432\u043e\u0439 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438, \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u044f \u0442\u0430\u043a\u0436\u0435 \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0438 \u0441\u0430\u043c\u0443 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044e:# Transform first joint to be local to sim and append sim as root boney_pos[:, 0] = quat_utils.inv_mul_vec(sim_bone_rot, y_pos[:, 0] &#8212; sim_bone_pos)y_rot[:, 0] = quat_utils.inv_mul(sim_bone_rot, y_rot[:, 0])y_pos = torch.concat([sim_bone_pos.unsqueeze(1), y_pos], dim=1)y_rot = torch.concat([sim_bone_rot.unsqueeze(1), y_rot], dim=1)parents = torch.concat([torch.tensor((-1,)), parents + 1])\u041f\u043e\u0441\u043b\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0439 \u043a\u043e\u0441\u0442\u0438 \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u0434\u0430\u0447\u0430 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0435\u0439 \u0432\u0441\u0435\u0445 \u043a\u043e\u0441\u0442\u0435\u0439 \u0441\u043a\u0435\u043b\u0435\u0442\u0430.  \u0421\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043a\u043e\u0441\u0442\u0435\u0439\u0421\u0438\u043b\u044c\u043d\u044b\u0435 \u0432\u044b\u0431\u0440\u043e\u0441\u044b \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u043a \u0434\u0440\u043e\u0436\u0430\u043d\u0438\u044e \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443, \u0445\u043e\u0442\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0438 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u043f\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u0443\u043b\u0435, \u0434\u043b\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0441\u0438\u043b\u044c\u043d\u044b\u0445 \u0432\u0441\u043f\u043b\u0435\u0441\u043a\u043e\u0432 \u043b\u0443\u0447\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u044e \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u043e\u0439 \u0440\u0430\u0437\u043d\u043e\u0441\u0442\u0438 (central difference) vel[1:-1] = (pos[2:] &#8212; pos[1:-1] +            pos[1:-1] &#8212; pos[:-2]) * 0.5 * fpsvel[0] = vel[1] &#8212; (vel[3] &#8212; vel[2])vel[-1] = vel[-2] + (vel[-2] &#8212; vel[-3])\u041c\u0435\u0442\u043e\u0434 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u043e\u0435 \u043e\u043a\u043d\u043e \u0432\u043e\u043a\u0440\u0443\u0433 \u043e\u0434\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0438. \u042d\u0442\u043e \u0434\u0430\u0435\u0442 \u0442\u0440\u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0430:\u0448\u0443\u043c\u044b \u0438 \u0441\u043a\u0430\u0447\u043a\u0438 \u0432 \u043e\u0434\u043d\u043e\u043c \u043a\u0430\u0434\u0440\u0435 \u043a\u043e\u043c\u043f\u0435\u043d\u0441\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u043c\u0438 \u043a\u0430\u0434\u0440\u0430\u043c\u0438;\u043e\u0446\u0435\u043d\u043a\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0430 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 , \u0430 \u043d\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e, \u043a\u0430\u043a \u0432 forward\/backward difference;\u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u0433\u043b\u0430\u0434\u043a\u043e\u0439 \u0438 \u043c\u0435\u043d\u0435\u0435 \u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043a \u0435\u0434\u0438\u043d\u0438\u0447\u043d\u044b\u043c \u0432\u044b\u0431\u0440\u043e\u0441\u0430\u043c;\u041e\u0434\u043d\u0430\u043a\u043e \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0432\u044b\u0431\u0440\u043e\u0441\u044b \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435 \u043d\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f\u00a0\u2014 \u0441\u043d\u0438\u0436\u0430\u0435\u0442\u0441\u044f \u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043a \u0448\u0443\u043c\u0443.\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u044e\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0442\u043e\u0447\u043a\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0439 \u044d\u043a\u0441\u0442\u0440\u0430\u043f\u043e\u043b\u044f\u0446\u0438\u0438, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e, \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0442\u0430\u043c \u043d\u0435\u0442 \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u0445 \u0442\u043e\u0447\u0435\u043a \u0441 \u043e\u0431\u0435\u0438\u0445 \u0441\u0442\u043e\u0440\u043e\u043d.\u0420\u0430\u0437\u043e\u0431\u0440\u0430\u0432\u0448\u0438\u0441\u044c \u0441 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435\u043c \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438, \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u0447\u0435\u0440\u0435\u0434 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a\u043e\u0441\u0442\u0435\u0439 \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0430 \u043d\u043e\u0433 \u0441 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c\u044e.2-column rotation matrix\u041a\u0430\u043a \u0431\u044b\u043b\u043e \u0441\u043a\u0430\u0437\u0430\u043d\u043e \u0440\u0430\u043d\u0435\u0435 (\u0441\u043c. quaternion unroll), \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u043d\u0438\u0435 \u043a\u0432\u0430\u0442\u0435\u0440\u043d\u0438\u043e\u043d\u043e\u0432 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c\u044e \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a\u043e\u0441\u0442\u0435\u0439 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0438 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432 \u0432\u0438\u0434\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0432\u0435\u043a\u0442\u043e\u0440\u043e\u0432 \u00ab\u0432\u043f\u0435\u0440\u0435\u0434\u00bb \u0438 \u00ab\u0432\u0432\u0435\u0440\u0445\u00bb.def to_xform_xz(x):   qx, qy, qz, qw = x[&#8230;, 0:1], x[&#8230;, 1:2], x[&#8230;, 2:3], x[&#8230;, 3:4]   x2, y2, z2 = qx + qx, qy + qy, qz + qz   # Precompute products for the rotation matrix   xx, yy, wx = qx * x2, qy * y2, qw * x2   xy, yz, wy = qx * y2, qy * z2, qw * y2   xz, zz, wz = qx * z2, qz * z2, qw * z2   return torch.concatenate([       torch.concatenate([1.0 &#8212; (yy + zz), xz + wy], dim=-1)[&#8230;, torch.newaxis, :],       torch.concatenate([xy + wz, yz &#8212; wx], dim=-1)[&#8230;, torch.newaxis, :],       torch.concatenate([xz &#8212; wy, 1.0 &#8212; (xx + yy)], dim=-1)[&#8230;, torch.newaxis, :],   ], dim=-2)\u041a\u043e\u043d\u0442\u0430\u043a\u0442 \u043d\u043e\u0433 \u0441 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c\u044e\u041c\u043e\u0436\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0441 \u0437\u0430\u0434\u0430\u043d\u0438\u0435\u043c \u043f\u043e\u0440\u043e\u0433\u043e\u0432\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u00a0\u2014 \u0435\u0441\u043b\u0438 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043d\u0438\u0436\u0435, \u0442\u043e \u0441\u0447\u0438\u0442\u0430\u0435\u043c, \u0447\u0442\u043e \u043d\u043e\u0433\u0430 \u0441\u0442\u043e\u0438\u0442 \u043d\u0430 \u043c\u0435\u0441\u0442\u0435. L2-\u043d\u043e\u0440\u043c\u0430 3D \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0441\u0432\u043e\u0434\u0438\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a \u0441\u043a\u0430\u043b\u044f\u0440\u0443. \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043c\u0435\u0434\u0438\u0430\u043d\u043d\u044b\u0439 \u0444\u0438\u043b\u044c\u0442\u0440 \u0434\u043b\u044f \u0443\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0445 \u00ab\u043e\u043a\u043e\u043d\u00bb (\u043b\u043e\u0436\u043d\u044b\u0445 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u0439):contact_velocity_threshold = 0.15 * 100  # to cm# L2 norm of 3D velocity collapses all motion into single scalar speedcontact_velocity = torch.norm(g_vel[:, [left_toe_id, right_toe_id]], dim=-1)extra = contact_velocity &lt; contact_velocity_thresholdfor ci in range(extra.shape[1]):   extra[:, ci] = torch.from_numpy(ndimage.median_filter(extra[:, ci], size=6, mode=&#8217;nearest&#8217;))\u041f\u0440\u0438\u043c\u0435\u0440 \u0440\u0430\u0431\u043e\u0442\u044b \u0444\u0438\u043b\u044c\u0442\u0440\u0430:\u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u0430\u0443\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u0434 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u043e\u0439 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0435\u0439 \u0432\u044b\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0440\u0430\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f.\u0422\u0440\u0430\u0435\u043a\u0442\u043e\u0440\u0438\u044f \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f\u0422\u0440\u0430\u0435\u043a\u0442\u043e\u0440\u0438\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u0447\u043a\u0430\u0445 20, 40, 60 \u043a\u0430\u0434\u0440\u043e\u0432 \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0447\u0435\u0441\u0442\u044c \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u0435 \u0440\u043e\u043b\u0438\u043a\u0430 \u0438 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0435\u0433\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c:def clamp_frame(frame, offset):   for i in range(len(range_starts)):       if range_starts[i] &lt;= frame &lt; range_stops[i]:           return min(max(frame + offset, range_starts[i].item()), range_stops[i].item() &#8212; 1)for i in range(start, stop):   future_frame_20 = clamp_frame(i, 20)   future_frame_40 = clamp_frame(i, 40)   future_frame_60 = clamp_frame(i, 60)\u0422\u0430\u043a, \u043f\u043e \u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0435\u043d\u0438\u044e \u043a \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044e \u0440\u043e\u043b\u0438\u043a\u0430, \u043c\u044b \u043f\u043b\u0430\u0432\u043d\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u043c \u0431\u0443\u0434\u0443\u0449\u0438\u0439 \u043a\u0430\u0434\u0440 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c.\u041f\u043e\u0437\u0438\u0446\u0438\u0438 \u0438 \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u0442\u0440\u0430\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u0430\u043a \u0440\u0430\u0437\u043d\u043e\u0441\u0442\u044c, \u043e\u0434\u043d\u0430\u043a\u043e, \u0435\u0441\u043b\u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u043c\u043d\u043e\u0436\u0438\u0442\u044c \u043d\u0430 \u043e\u0431\u0440\u0430\u0442\u043d\u044b\u0439 \u043a\u0432\u0430\u0442\u0435\u0440\u043d\u0438\u043e\u043d Root transformation, \u0442\u043e \u043c\u044b \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0435\u043c \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0430 \u0442\u0430\u043a, \u0447\u0442\u043e \u043e\u043d \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u043a\u0430\u0434\u0440\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432\u0441\u0435\u0433\u0434\u0430 \u0432 \u043e\u0434\u043d\u043e\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0434\u043e\u0441\u0442\u0438\u0433\u0430\u0435\u0442\u0441\u044f \u0438\u043d\u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043d\u043e\u0441\u0442\u044c \u043f\u043e \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044e \u043a \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044e \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f.traj_pos_20 = quat_utils.inv_mul_vec(y_rot[i, 0], y_pos[future_frame_20, 0] &#8212; y_pos[i, 0])traj_pos_40 = quat_utils.inv_mul_vec(y_rot[i, 0], y_pos[future_frame_40, 0] &#8212; y_pos[i, 0])traj_pos_60 = quat_utils.inv_mul_vec(y_rot[i, 0], y_pos[future_frame_60, 0] &#8212; y_pos[i, 0])# Rotate the local forward vector (1.0, 0.0, 0.0) because X is forward to get world-space forwardtraj_dir_20 = quat_utils.inv_mul_vec(y_rot[i, 0], quat_utils.mul_vec(y_rot[future_frame_20, 0], torch.tensor((1.0, 0.0, 0.0))))traj_dir_40 = quat_utils.inv_mul_vec(y_rot[i, 0], quat_utils.mul_vec(y_rot[future_frame_40, 0], torch.tensor((1.0, 0.0, 0.0))))traj_dir_60 = quat_utils.inv_mul_vec(y_rot[i, 0], quat_utils.mul_vec(y_rot[future_frame_60, 0], torch.tensor((1.0, 0.0, 0.0))))\u0422\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0437\u0438\u0446\u0438\u0439 \u0438 \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0439 \u043a\u043e\u0441\u0442\u0435\u0439, \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0432 \u043d\u0430\u0431\u043e\u0440 \u0434\u043b\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043f\u043e\u0437\u044b (features):left_foot_pos = quat_utils.inv_mul_vec(rot[:, 0], g_pos[:, left_foot_id] &#8212; g_pos[:, 0])right_foot_pos = quat_utils.inv_mul_vec(rot[:, 0], g_pos[:, right_foot_id] &#8212; g_pos[:, 0])left_foot_vel = quat_utils.inv_mul_vec(rot[:, 0], g_vel[:, left_foot_id])right_foot_vel = quat_utils.inv_mul_vec(rot[:, 0], g_vel[:, right_foot_id])hips_vel = quat_utils.inv_mul_vec(rot[:, 0], g_vel[:, hips_node_id])\u041d\u0430 \u044d\u0442\u043e \u0430\u0443\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f.Projector nearest neighbor search\u041d\u0430\u043f\u043e\u043c\u043d\u044e, \u0447\u0442\u043e \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c Projector \u044d\u043c\u0443\u043b\u0438\u0440\u0443\u0435\u0442 \u043f\u043e\u0438\u0441\u043a \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0435\u0433\u043e \u0441\u043e\u0441\u0435\u0434\u0430 \u0434\u043b\u044f . \u0417\u0430\u0434\u0430\u0447\u0430 \u0441\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044e \u0435\u0432\u043a\u043b\u0438\u0434\u043e\u0432\u043e\u0433\u043e \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0435\u043c\u043a\u043e\u0439, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u0441\u0435\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430.\u0414\u043b\u044f \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 sklearn.neighbors.BallTree:from sklearn.neighbors import BallTreetree = BallTree(x)nearest = tree.query(x_hat, k=1, return_distance=False)[:, 0]\u041c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, faiss, \u043e\u043d \u0434\u0430\u0441\u0442 \u0435\u0449\u0435 \u0431\u043e\u043b\u044c\u0448\u0438\u0439 \u043f\u0440\u0438\u0440\u043e\u0441\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u043d\u043e \u0438 \u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043d\u0435 \u0442\u0430\u043a\u043e\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0435, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0435\u0442 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 Windows.\u0421\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0438 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439\u041f\u043e\u0441\u043b\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0435\u0439 LMM \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0437\u0430\u0434\u0430\u0447\u0430 \u0438\u0445 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0432 \u043a\u043e\u043d\u0435\u0447\u043d\u0443\u044e \u0441\u0440\u0435\u0434\u0443. \u0412\u0430\u0436\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0444\u043e\u0440\u043c\u0430\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0443\u0434\u043e\u0431\u0435\u043d \u0434\u043b\u044f \u0438\u043d\u0444\u0435\u0440\u0435\u043d\u0441\u0430 \u0438 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c \u0441 \u0434\u0432\u0438\u0436\u043a\u043e\u043c.\u0417\u0434\u0435\u0441\u044c \u0435\u0441\u0442\u044c 2 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u0440\u0435\u0448\u0435\u043d\u0438\u044f:\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-486495","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/486495","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=486495"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/486495\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=486495"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=486495"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=486495"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}