wolfram语言入门
You can’t teach an old dog new tricks, but maybe you can teach a neural network to draw a picture of a cat? The other day, when I was perusing the always interesting Wolfram Neural Network Repository, I came across a little gem. A neural network unassumingly called Sketch-RNN claimed to be able to draw cats, dogs, trombones, windmills, and a host of other animals and objects. This, I had to try!
您不能教老狗新的花样,但也许您可以教神经网络绘制猫的照片? 前几天,当我仔细阅读总是很有趣的Wolfram神经网络存储库时,我遇到了一个小问题。 粗略地称为Sketch-RNN的神经网络声称能够绘制猫,狗,长号,风车以及许多其他动物和物体的图画。 这,我不得不尝试!
To draw a sketch, this Sketch-RNN page prompted me to copy and paste a big blob of Wolfram Language code. This worked very nicely, but I wanted to have a single function to hide all that complexity. So I wrote a simple ResourceFunction to do exactly this.
要绘制草图,此Sketch-RNN页面提示我复制并粘贴一大块Wolfram语言代码。 这工作得很好,但是我想有一个功能来掩盖所有这些复杂性。 所以我写了一个简单的ResourceFunction来做到这一点。
These resource functions are great because they are basically lumps of code that get automatically downloaded from the web:
这些资源功能很棒,因为它们基本上是从网上自动下载的大量代码:
DrawSketch = ResourceFunction[
"user:arnoudb/DeployedResources/Function/DrawSketch"
]
With this resource function, I was able to try to sketch my first animal:
通过此资源功能,我能够尝试绘制我的第一个动物:
OK, so the result is more a Picasso than a Rembrandt but obviously it is getting the essence of a cat right. Presumably, with an improved neural network and more advanced training data, this has the potential to go much further.
好的,所以结果更像是毕加索而非伦勃朗,但显然它使猫的本质变得正确。 据推测,有了改进的神经网络和更高级的训练数据,这有可能进一步发展。
All sketches have a random generation element to them, so you can sketch 25 cats and they will all look unique!
所有草图都具有随机生成元素,因此您可以绘制25只猫,它们看起来都将独一无二!
There are a total of 114 animals and objects you can draw with this nifty function. I decided to give them all a whirl. Many items are instantly recognizable, while some others are a bit more mysterious:
使用这个漂亮的功能,您可以绘制总共114种动物和物体。 我决定给他们一个旋转。 许多物品可以立即识别,而另一些则更加神秘:
You can have more fun with this by modifying the original DrawSketch function and adding random colors and line thicknesses to the mix. Here is one example I made with pineapples:
您可以通过修改原始的DrawSketch函数并在混合中添加随机的颜色和线条粗度来获得更多乐趣。 这是我用菠萝制作的一个示例:
The possibilities are endless here and quite fun to try them all out. I can’t see any practical application for this, except maybe inspiring preschoolers to draw certain objects by providing them lots and lots of examples to copy from. I hope you liked this silly little story and, if you’re interested in learning more about the Wolfram Language, check out my recent post titled “Learning Wolfram, Zero to Hero”. It has a great set of pointers to learning resources for this programming language! 😻🍍
这里的可能性是无穷无尽的,将它们全部尝试出来很有趣。 我看不到有任何实际的应用程序,除了可能会启发学龄前儿童通过提供大量要复制的示例来绘制某些对象来绘画它们。 我希望您喜欢这个愚蠢的小故事,并且,如果您想对Wolfram语言有更多的了解,请查阅我最近的标题为“学习Wolfram,从零到英雄”的文章。 它为该编程语言提供了大量学习资源的指针! 😻🍍
Based on Sketch-RNN Trained on QuickDraw Data from the Wolfram Neural Network Repository
基于基于Wolfram神经网络存储库的QuickDraw数据训练的Sketch-RNN
Reference: D. Ha, D. Eck, “A Neural Representation of Sketch Drawings,” arXiv:1704.03477 (2017) available from https://github.com/tensorflow/magenta-demos/tree/master/sketch-rnn-js
参考:D。Ha,D。Eck,“草图的神经表示”,arXiv:1704.03477(2017),可从https://github.com/tensorflow/magenta-demos/tree/master/sketch-rnn-js获得
wolfram语言入门