动画系统的神经网络大小

发布于 2024-09-14 18:01:03 字数 584 浏览 3 评论 0原文

我决定使用神经网络来为我拥有的动画引擎创建行为。神经网络为我身体的每个部位接收 3 个向量和 1 个欧拉角。第一个向量 3 是位置,第二个向量是速度,第三个向量是角速度。欧拉角是身体部位的旋转角度。我的身体有 7 个部位。这些数据类型中的每一种都有 3 个浮点数。 7*4*3 = 84,所以我的神经网络有 84 个输入。输出被映射到角色的肌肉。它们提供作用于每块肌肉的力量,共有 15 个。

我同时运行 15 个网络 10 秒,通过计算最低能量消耗、z 和 x 运动量最少以及身体部位与其他部位相比是否处于正确的 y 位置 (hips.y >gt ; upperleg.y,upperleg.y > lowerleg.y 等),然后通过遗传算法运行它们。我运行的神经网络每个隐藏层有 168 个神经元,有 8 个隐藏层。我试图让角色站直,不要走​​动太多。我已经运行了 3000 代,但我什至没有接近。

神经网络和遗传算法是本教程的 C# 版本。我将交叉方法从一点改为混合。

我有 84 个输入和 15 个输出。我的神经网络应该有多大?

I decided to go with a Neural Network in order to create behaviors for an animation engine that I have. The neural network takes in 3 vector3s and 1 Euler angle for every body part that I have. The first vector3 is the position, the second is its velocity, and the third is its angular velocity. The Euler angle is what rotation the body part is at. and I have 7 body parts. Each one of those data types has 3 floats. 7*4*3 = 84, so I have 84 inputs for my neural network. The outputs are mapped to the muscles of the character. They provide the amount of strength to apply to each muscle, and there are 15 of them.

I am running 15 networks simultaneously for 10 seconds, rating their fitness by calculating the lowest energy use, having the least amount of z and x movement, and if the body parts are in the correct y position compared to the rest (hips.y > upperleg.y, upperleg.y > lowerleg.y etc.), and then running them through a genetic algorithm. I was running a neural network of 168 neurons per hidden layer, with 8 hidden layers. I'm trying to get the character to stand up straight and not move around too much. I ran this for 3000 generations and I didn't even come close.

The neural network and genetic algorithm are C# versions of this tutorial. I changed the crossover method from one point to blending.

I have 84 inputs and 15 outputs. How large should my Neural Network be?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

落花浅忆 2024-09-21 18:01:03

你想要解决的问题是一个相当棘手的问题,我怀疑任何“普通”GA(尤其是使用固定网络架构的)都会解决它(在合理的时间内)。我也不认为你会在隐藏层中找到“正确数量的神经元”。

但是,如果您愿意花一些时间,请查看 用于模块化机器人运动控制的 HyperNEAT 或多或少处理相同的问题。
他们使用了一种非常先进的 GA 技术,称为 HyperNEAT,并报告了一些良好的结果。

HyperNEAT 构建于 NEAT(增强拓扑的神经进化)之上。 NEAT 不仅能够进化 ANN 的权重,还能进化它们的结构。它从简单的网络开始,慢慢地使它们变得更加复杂,直到您达到目标(或放弃)。

然后 NEAT 稍作修改,以便能够使用各种激活函数。当它应用于一组点(例如坐标系中)时,它将使其能够产生各种“图案”。这些图案可以具有一些有趣的特征,例如完美/不完美的对称性,或者它们可以是周期性的。这种变体称为组合模式生成网络或CPPN。这项技术的一个引人注目的应用是 PicBreeder,其中网络用于“绘制”图片。

HyperNEAT 中,CPPN 用于创建其他 ANN。新网络的隐藏层由所谓的基底表示,可以想象该层的神经元被置于 2D/3D 坐标系中。然后,对于每对可能的神经元(所有从输入层到所有隐藏层、从所有隐藏层到所有输出层),CPPN 用于确定权重。因此,我们有一个间接编码,它

  • 本身很小
  • ,最终可以产生任意大的网络,
  • 这也可以显示
  • 现实/自然中出现的相当复杂的行为模式(同样,对称性、周期性行为)可以相对容易地出现。请注意,对于动画/有效运动来说,它们都非常有利(如果不是必须的话)。

总而言之,它会给您一个解决复杂问题的机会。

正如您所看到的,该技术有多个层次,因此您自己实现它并不那么容易。幸运的是,它有一些很好的实现,您可以在 NEAT 主页< /a>,以及许多其他文档、论文和教程。

The problem you want to solve is a quite tricky one, I doubt that any "vanilla" GAs (especially that use a fixed architecture for the networks) will solve it (in a reasonable time). I also don't think that you will ever find the "right number of neurons" in the hidden layer.

However, if you are willing to spend some time on it have a look at HyperNEAT for Locomotion Control in Modular Robots which deals with more or less the same problem.
They use a quite advanced GA technique called HyperNEAT and report some good results.

HyperNEAT is built on top of NEAT (Neuroevolution of augmenting topologies). NEAT is able to evolve not only the weights of ANNs, but also their structure. It starts with simple networks and slowly makes them more complex until you reach your goal (or give up).

Then NEAT is slightly altered, to be able to use various activation functions. It will enable it to produce a wide variety of "patterns" when it's applied to a set of points e.g. in a coordinate system. The patterns can have some interesting traits, like perfect/imperfect symmetry or they can be periodic. This variant is called Compositional pattern-producing network or CPPN. A spectacular application of this technology is PicBreeder where the networks are used to "draw" pictures.

In HyperNEAT the CPPNs are used to create other ANNs. The hidden layer of the new networks is represented by a so called substrate, which can be imagined as if the neurons of the layer are put to a 2D/3D coordinate system. Then for each possible pair of the neurons (all from input layer to all hidden, from all hidden to all output) the CPPN is used to determine the weight. Thus we have an indirect encoding, which

  • in itself is small
  • can produce arbitrary big networks at the end
  • which can also show quite complex behavior
  • patterns that show up in reality/nature (again, symmetry, periodic behavior) can emerge relatively easily. Note that for animation/effective locomotion both of them are very advantageous (if not a must).

All in all it would give you a chance to solve your complex problem.

As you can see there are various layers of this technique, so implementing it for your own is not that easy. Luckily there are some good implementations of it, you can find them on the NEAT home page, together with a lot of other docs, papers and tutorials.

不…忘初心 2024-09-21 18:01:03

有趣的方法!我已经思考类似的事情有一段时间了,很想听听你得到了什么结果。

你必须进行测试,但我猜你有太多隐藏层。我认为这个应用程序最多可以与一两个人一起使用。

你还应该看看你的健身功能——我怀疑提供学习可能“太难”了,从某种意义上说,一开始它没有希望站起来。因此,你跌倒的“局部最低限度”就是学习如何以最少的努力跌倒。不是很有用。一般来说,遗传算法经常受到局部极小值的影响。

为了提高你的健身功能,我会尝试像惩罚每一帧的直立偏差这样的事情。这将为管理部分平衡的解决方案带来一些荣誉,因此应该有一条改进路径。在你让它们达到平衡之前,我根本不会担心能源的使用。

Interesting approach! I've been thinking about something similar for a while, would love to hear what results you get.

You'll have to test, but I'd guess you have too many hidden layers. I think this application could work with one or two at most.

You should also take a look at your fitness function - I suspect that it might be "too difficult" to provide learning, in the sense that at the beginning it has no hope of standing up. Hence the "local minimum" you fall into is learning how to fall down with the least effort. Not very useful. GAs in general suffer from local minima quite a lot.

To improve your fitness function, I'd try something like penalising deviation from upright every frame. This will give some credit to solutions that manage partial balance, so there should be an improvement path. I wouldn't bother about energy use at all until you have got them to balance.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文