算法艺术创作
algorithmic-art
通过代码和可调参数创作生成艺术与交互式视觉效果。
neural-network-visualization【设计与创意】Use this operating sub-skill to create, adapt, and troubleshoot ManimML neural-network scenes: NeuralNetwork containers, feed-forward and convolutional layers, image/embedding/vector/math/triplet/paired-query layers, connective layers, forward-pass animations, dropout, residual/manual connections, insertion/removal animations, and small safe render s…
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
manim_ml.neural_network.NeuralNetwork, feed-forward layers, convolution/max-pooling/image layers, activation functions, embeddings, vector outputs, math-operation nodes, triplet or paired-query image inputs, VAE-like diagrams, dropout, forward-pass animations, or residual/skip connections.Route decision-tree, MCMC, Gaussian/probability, and matplotlib/statistical workflows to the sibling statistical-visualization sub-skill. Route Manim Community installation, cairo/Pango/ffmpeg, or system-render failures to the root ManimML troubleshooting reference first, then return here for layer/API mistakes.
ManimML scenes require Manim Community, not the original 3Blue1Brown Manim package. Before writing task-specific code, use a small import check in the user's active environment:
python - <<'PY'
import manim
from manim_ml.neural_network import NeuralNetwork, FeedForwardLayer
print("manim", getattr(manim, "__version__", "unknown"))
print(NeuralNetwork, FeedForwardLayer)
PY
For a no-assets starter script, prefer the bundled helper:
python sub-skills/neural-network-visualization/scripts/render_neural_network_example.py --help
python sub-skills/neural-network-visualization/scripts/render_neural_network_example.py --mode feed-forward --scene-file nn_example.py
manim -ql -s nn_example.py ManimMLNeuralNetworkExample
The helper writes a scene by default and renders only when explicitly asked with --render.
feed-forward, cnn, image-cnn, residual, dropout, embedding, triplet, paired-query, vector-math, and vae.from manim import *
from manim_ml.neural_network import NeuralNetwork, FeedForwardLayer
class MyScene(Scene):
def construct(self):
nn = NeuralNetwork([
FeedForwardLayer(3),
FeedForwardLayer(5, activation_function="ReLU"),
FeedForwardLayer(2),
])
nn.move_to(ORIGIN)
self.add(nn)
self.play(nn.make_forward_pass_animation(run_time=3))
Use ThreeDScene when the network includes Convolutional2DLayer or MaxPooling2DLayer, because those layers are rendered as rotated 3D-style feature-map stacks.
manim_ml.neural_network."ReLU" and "Sigmoid".make_forward_pass_animation(layer_args=...) keys are layer/connective object instances, not layer names.add_connection(...) supports the default connection style; choose arc_direction="straight", "up", "down", "left", or "right" for the visual route.manim -ql -s.NeuralNetwork([FeedForwardLayer(3), FeedForwardLayer(2)]), add it to a Scene, and confirm the scene imports.ThreeDScene with Convolutional2DLayer, MaxPooling2DLayer, and FeedForwardLayer; prefer a still render first.image-cnn, triplet, or paired-query modes to generate tiny fixtures, then render the produced scene file.