Giter VIP home page Giter VIP logo

manimml's Introduction

ManimML

GitHub license GitHub tag Downloads

ManimML is a project focused on providing animations and visualizations of common machine learning concepts with the Manim Community Library. Please check out our paper. We want this project to be a compilation of primitive visualizations that can be easily combined to create videos about complex machine learning concepts. Additionally, we want to provide a set of abstractions which allow users to focus on explanations instead of software engineering.

A sneak peak ...

Table of Contents

Getting Started

Installation

First you will want to install manim. Make sure it is the Manim Community edition, and not the original 3Blue1Brown Manim version.

Then install the package form source or pip install manim_ml. Note: some recent features may only available if you install from source.

First Neural Network

This is a visualization of a Convolutional Neural Network. The code needed to generate this visualization is shown below.

from manim import *

from manim_ml.neural_network import Convolutional2DLayer, FeedForwardLayer, NeuralNetwork

# This changes the resolution of our rendered videos
config.pixel_height = 700
config.pixel_width = 1900
config.frame_height = 7.0
config.frame_width = 7.0

# Here we define our basic scene
class BasicScene(ThreeDScene):

    # The code for generating our scene goes here
    def construct(self):
        # Make the neural network
        nn = NeuralNetwork([
                Convolutional2DLayer(1, 7, 3, filter_spacing=0.32),
                Convolutional2DLayer(3, 5, 3, filter_spacing=0.32),
                Convolutional2DLayer(5, 3, 3, filter_spacing=0.18),
                FeedForwardLayer(3),
                FeedForwardLayer(3),
            ],
            layer_spacing=0.25,
        )
        # Center the neural network
        nn.move_to(ORIGIN)
        self.add(nn)
        # Make a forward pass animation
        forward_pass = nn.make_forward_pass_animation()
        # Play animation
        self.play(forward_pass)

You can generate the above video by copying the above code into a file called example.py and running the following in your command line (assuming everything is installed properly):

$ manim -pql example.py

The above generates a low resolution rendering, you can improve the resolution (at the cost of slowing down rendering speed) by running:

$ manim -pqh example.py

Guide

This is a more in depth guide showing how to use various features of ManimML (Note: ManimML is still under development so some features may change, and documentation is lacking).

Setting Up a Scene

In Manim all of your visualizations and animations belong inside of a Scene. You can make a scene by extending the Scene class or the ThreeDScene class if your animation has 3D content (as does our example). Add the following code to a python module called example.py.

from manim import *
# Import modules here

class BasicScene(ThreeDScene):

    def construct(self):
        # Your code goes here
        text = Text("Your first scene!")
        self.add(text)

In order to render the scene we will run the following in the command line:

$ manim -pq -l example.py

This will generate an image file in low quality (use -h for high quality).

For the rest of the tutorial the code snippets will need to be copied into the body of the construct function.

A Simple Feed Forward Network

With ManimML we can easily visualize a simple feed forward neural network.

from manim_ml.neural_network import NeuralNetwork, FeedForwardLayer

nn = NeuralNetwork([
    FeedForwardLayer(num_nodes=3),
    FeedForwardLayer(num_nodes=5),
    FeedForwardLayer(num_nodes=3)
])
self.add(nn)

In the above code we create a NeuralNetwork object and pass a list of layers to it. For each feed forward layer we specify the number of nodes. ManimML will automatically piece together the individual layers into a single neural network. We call self.add(nn) in the body of the scene's construct method in order to add the neural network to the scene.

The majority of ManimML neural network objects and functions can be imported directly from manim_ml.neural_network.

We can now render a still frame image of the scene by running:

$ manim -pql example.py

Animating the Forward Pass

We can automatically render the forward pass of a neural network by creating the animation with the neural_network.make_forward_pass_animation method and play the animation in our scene with self.play(animation).

from manim_ml.neural_network import NeuralNetwork, FeedForwardLayer
# Make the neural network
nn = NeuralNetwork([
    FeedForwardLayer(num_nodes=3),
    FeedForwardLayer(num_nodes=5),
    FeedForwardLayer(num_nodes=3)
])
self.add(nn)
# Make the animation
forward_pass_animation = nn.make_forward_pass_animation()
# Play the animation
self.play(forward_pass_animation)

We can now render with:

$ manim -pql example.py

Convolutional Neural Networks

ManimML supports visualizations of Convolutional Neural Networks. You can specify the number of feature maps, feature map size, and filter size as follows Convolutional2DLayer(num_feature_maps, feature_map_size, filter_size). There are a number of other style parameters that we can change as well(documentation coming soon).

Here is a multi-layer convolutional neural network. If you are unfamiliar with convolutional networks this overview is a great resource. Additionally, CNN Explainer is a great interactive tool for understanding CNNs, all in the browser.

When specifying CNNs it is important for the feature map sizes and filter dimensions of adjacent layers match up.

from manim_ml.neural_network import NeuralNetwork, FeedForwardLayer, Convolutional2DLayer

nn = NeuralNetwork([
        Convolutional2DLayer(1, 7, 3, filter_spacing=0.32), # Note the default stride is 1. 
        Convolutional2DLayer(3, 5, 3, filter_spacing=0.32),
        Convolutional2DLayer(5, 3, 3, filter_spacing=0.18),
        FeedForwardLayer(3),
        FeedForwardLayer(3),
    ],
    layer_spacing=0.25,
)
# Center the neural network
nn.move_to(ORIGIN)
self.add(nn)
# Make a forward pass animation
forward_pass = nn.make_forward_pass_animation()

We can now render with:

$ manim -pql example.py

And there we have it, a convolutional neural network.

Convolutional Neural Network with an Image

We can also animate an image being fed into a convolutional neural network by specifiying an ImageLayer before the first convolutional layer.

import numpy as np
from PIL import Image
from manim_ml.neural_network import NeuralNetwork, FeedForwardLayer, Convolutional2DLayer, ImageLayer

image = Image.open("digit.jpeg") # You will need to download an image of a digit. 
numpy_image = np.asarray(image)

nn = NeuralNetwork([
        ImageLayer(numpy_image, height=1.5),
        Convolutional2DLayer(1, 7, 3, filter_spacing=0.32), # Note the default stride is 1. 
        Convolutional2DLayer(3, 5, 3, filter_spacing=0.32),
        Convolutional2DLayer(5, 3, 3, filter_spacing=0.18),
        FeedForwardLayer(3),
        FeedForwardLayer(3),
    ],
    layer_spacing=0.25,
)
# Center the neural network
nn.move_to(ORIGIN)
self.add(nn)
# Make a forward pass animation
forward_pass = nn.make_forward_pass_animation()

We can now render with:

$ manim -pql example.py

Max Pooling

A common operation in deep learning is the 2D Max Pooling operation, which reduces the size of convolutional feature maps. We can visualize max pooling with the MaxPooling2DLayer.

from manim_ml.neural_network import NeuralNetwork, Convolutional2DLayer, MaxPooling2DLayer
# Make neural network
nn = NeuralNetwork([
        Convolutional2DLayer(1, 8),
        Convolutional2DLayer(3, 6, 3),
        MaxPooling2DLayer(kernel_size=2),
        Convolutional2DLayer(5, 2, 2),
    ],
    layer_spacing=0.25,
)
# Center the nn
nn.move_to(ORIGIN)
self.add(nn)
# Play animation
forward_pass = nn.make_forward_pass_animation()
self.wait(1)
self.play(forward_pass)

We can now render with:

$ manim -pql example.py

Activation Functions

Activation functions apply non-linarities to the outputs of neural networks. They have different shapes, and it is useful to be able to visualize the functions. I added the ability to visualize activation functions over FeedForwardLayer and Convolutional2DLayer by passing an argument as follows:

layer = FeedForwardLayer(num_nodes=3, activation_function="ReLU")

We can add these to larger neural network as follows:

from manim_ml.neural_network import NeuralNetwork, Convolutional2DLayer, FeedForwardLayer
# Make nn
nn = NeuralNetwork([
        Convolutional2DLayer(1, 7, filter_spacing=0.32),
        Convolutional2DLayer(3, 5, 3, filter_spacing=0.32, activation_function="ReLU"),
        FeedForwardLayer(3, activation_function="Sigmoid"),
    ],
    layer_spacing=0.25,
)
self.add(nn)
# Play animation
forward_pass = nn.make_forward_pass_animation()
self.play(forward_pass)

We can now render with:

$ manim -pql example.py

More Complex Animations: Neural Network Dropout

from manim_ml.neural_network import NeuralNetwork, FeedForwardLayer
from manim_ml.neural_network.animations.dropout import make_neural_network_dropout_animation
# Make nn
nn = NeuralNetwork([
        FeedForwardLayer(3),
        FeedForwardLayer(5),
        FeedForwardLayer(3),
        FeedForwardLayer(5),
        FeedForwardLayer(4),
    ],
    layer_spacing=0.4,
)
# Center the nn
nn.move_to(ORIGIN)
self.add(nn)
# Play animation
self.play(
    make_neural_network_dropout_animation(
        nn, dropout_rate=0.25, do_forward_pass=True
    )
)
self.wait(1)

We can now render with:

$ manim -pql example.py

Citation

If you found ManimML useful please cite it below!

@misc{helbling2023manimml,
      title={ManimML: Communicating Machine Learning Architectures with Animation}, 
      author={Alec Helbling and Duen Horng and Chau},
      year={2023},
      eprint={2306.17108},
      archivePrefix={arXiv},
      primaryClass={cs.LG}
}

manimml's People

Contributors

amanpriyanshu avatar helblazer811 avatar lawreros avatar yanndubs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

manimml's Issues

2D Max Pooling Layer

The max pooling visualization can work as follows:

  1. Draw boxes around the max pooling regions in the input feature maps.
  2. Randomly highlight a square from one of the boxes.
  3. Make an invisible set of reduced width and height output feature maps.
  4. Move each square to its corresponding location in the output feature map with an animation.
  5. Make the output feature map appear.

If this is too busy then maybe an alternative is:

  1. Draw boxes around the max pooling regions in the input feature maps.
  2. Make an invisible set of reduced width and height output feature maps.
  3. Resize and translate each square to the appropriate location in the output feature maps.
  4. Make the output feature map appear.

Add Documentation for all Arguments

I want to setup numpy style documentation for the library to work with jeckyll documentation generation. I should also add a doc style check to the CI pipeline.

Layer Labeling and Dimension Labeling

Add a system for displaying labels of various kinds in the architecture diagram. One such kind is the name of the layer above it. Another one is showing a dimension of a vector or convolutional filter. It should be possible to override the name of it in the event that you want to show different dimension numbers (say for the sake of explaining a very high dimensional layer from a real architecture).

Make Canonical Animations as Objects

Manim has the ability to represent animations as classes. These classes can take parameters and they can wrap around a passed Mobject (in our case this could be a neural network) and then a mobject specific animation is run. You can override such animations like Create (see neural_network.py). It would be interesting to make a generic TrainModel animation that is implemented by various models and emulates the training procedure.

For now, I could implement these animations as functions in the manim_ml/neural_network/animations directory.

Camera Moving Forward Pass

It would be cool to have an animation where the camera flies with the forward pass animation. This would be especially valuable for visualizing very king architectures.

Convolutional Neural Network Enhancements

I want to add the following features:

  1. Max Pooling
  2. Padding
  3. Change the parameters for the Convolutional3d layers to be more ergonomic.
  4. Add an option to make the feature map appear as the filter scans across it rather than it being there all at once.
  5. Add a FlattenLayer that flattens a preceding convolutional layer.
  6. Add the ability to put random numbers into the cells of the feature maps.

Add pytest frame comparison testing

It is useful to have tests that compare a reference video and a generated video frame by frame. They do this in the manim.community library. I want to set this type of testing up for our systems.

AttributeError: MaxPooling2DLayer object has no attribute 'padding'

The code from the example of MaxPooling2DLayer returns AttributeError. Same for /examples/cnn/cnn_max_pool.py

Using manim==0.17.2 and manim-ml==0.0.16.

from manim import *

from manim_ml.neural_network import NeuralNetwork, Convolutional2DLayer, MaxPooling2DLayer

class BasicScene(ThreeDScene):
    def construct(self):
        nn = NeuralNetwork(
            [
                Convolutional2DLayer(1, 8),
                Convolutional2DLayer(3, 6, 3),
                MaxPooling2DLayer(
                    kernel_size=2,
                ),
                Convolutional2DLayer(5, 2, 2),
            ],
            layer_spacing=0.25,
        )
        nn.move_to(ORIGIN)
        self.add(nn)
        forward_pass = nn.make_forward_pass_animation()
        self.wait(1)
        self.play(forward_pass)`

Stack trace:

convolutional_2d_to_convolutional_2d.py:309 in init
│ │
│ 306 │ │ self.num_output_feature_maps = self.output_layer.num_feature_maps │
│ 307 │ │ self.cell_width = self.output_layer.cell_width │
│ 308 │ │ self.stride = self.output_layer.stride │
│ ❱ 309 │ │ self.padding = self.input_layer.padding │
│ 310 │ │ self.filter_opacity = filter_opacity │
│ 311 │ │ self.cell_width = cell_width │
│ 312 │ │ self.line_color = line_color

mobject.py:660 │
│ in getattr
│ │
│ 657 │ │ │ return types.MethodType(setter, self) │
│ 658 │ │ │
│ 659 │ │ # Unhandled attribute, therefore error │
│ ❱ 660 │ │ raise AttributeError(f"{type(self).name} object has no attribute '{attr} │
│ 661 │ │
│ 662 │ @Property
│ 663 │ def width(self):

AttributeError: MaxPooling2DLayer object has no attribute 'padding'

Transformer Visualization

I want to make visualization systems for visualizing transformers, specifically self-attention. It would be nice if it worked for Vision Transformers as well as Language Models.

neural network title is fixed

Adding a title to a NeuralNetwork and moving or scaling it after does not work. The title stays and does not move respectively.

'size' has incorrect type (expected int, got float)

I am just trying to run the first example in the Readme.md. I am running on an M1 Pro Mac. I did a conda install of Manim Community v0.17.3 and pip install of the python library (manim 0.17.3, manim-ml 0.0.24). I am getting the following TypeError:

manim -pql manim_test.py

Manim Community v0.17.3

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /Blah/lib/python3.10/site-packages/manim/cli/render/command │
│ s.py:115 in render │
│ │
│ 112 │ │ │ try: │
│ 113 │ │ │ │ with tempconfig({}): │
│ 114 │ │ │ │ │ scene = SceneClass() │
│ ❱ 115 │ │ │ │ │ scene.render() │
│ 116 │ │ │ except Exception: │
│ 117 │ │ │ │ error_console.print_exception() │
│ 118 │ │ │ │ sys.exit(1) │
│ │
│ /Blah/lib/python3.10/site-packages/manim/scene/scene.py:223 │
│ in render │
│ │
│ 220 │ │ """ │
│ 221 │ │ self.setup() │
│ 222 │ │ try: │
│ ❱ 223 │ │ │ self.construct() │
│ 224 │ │ except EndSceneEarlyException: │
│ 225 │ │ │ pass │
│ 226 │ │ except RerunSceneException as e: │
│ │
│ /Blah/manim_test.py:18 in │
│ construct │
│ │
│ 15 │ def construct(self): │
│ 16 │ │ # Make the neural network │
│ 17 │ │ nn = NeuralNetwork([ │
│ ❱ 18 │ │ │ │ Convolutional2DLayer(int(1), int(7), int(3), filter_spacing=0.32), │
│ 19 │ │ │ │ Convolutional2DLayer(int(3), int(5), int(3), filter_spacing=0.32), │
│ 20 │ │ │ │ Convolutional2DLayer(int(5), int(3), int(3), filter_spacing=0.18), │
│ 21 │ │ │ │ FeedForwardLayer(3), │
│ │
│ /Blah/lib/python3.10/site-packages/manim_ml/neural_network/ │
│ layers/convolutional_2d.py:128 in init
│ │
│ 125 │ │ padding_dashed=True, │
│ 126 │ │ **kwargs, │
│ 127 │ ): │
│ ❱ 128 │ │ super().init(**kwargs) │
│ 129 │ │ self.num_feature_maps = num_feature_maps │
│ 130 │ │ self.filter_color = filter_color │
│ 131 │ │ if isinstance(padding, tuple): │
│ │
│ /Blah/lib/python3.10/site-packages/manim_ml/neural_network/ │
│ layers/parent_layers.py:46 in init
│ │
│ 43 │
│ 44 class VGroupNeuralNetworkLayer(NeuralNetworkLayer): │
│ 45 │ def init(self, *args, **kwargs): │
│ ❱ 46 │ │ super().init(*args, **kwargs) │
│ 47 │ │ # self.camera = camera │
│ 48 │ │
│ 49 │ @AbstractMethod
│ │
│ /Blah/lib/python3.10/site-packages/manim_ml/neural_network/ │
│ layers/parent_layers.py:10 in init
│ │
│ 7 │ def init(self, text=None, *args, **kwargs): │
│ 8 │ │ super(Group, self).init() │
│ 9 │ │ self.title_text = kwargs["title"] if "title" in kwargs else " " │
│ ❱ 10 │ │ self.title = Text(self.title_text, font_size=DEFAULT_FONT_SIZE / 3).scale(0.6) │
│ 11 │ │ self.title.next_to(self, UP, 1.2) │
│ 12 │ │ # self.add(self.title) │
│ 13 │
│ │
│ /Blah/lib/python3.10/site-packages/manim/mobject/text/text_ │
│ mobject.py:486 in init
│ │
│ 483 │ │ │ self.line_spacing = self._font_size + self._font_size * self.line_spacing │
│ 484 │ │ │
│ 485 │ │ color = Color(color) if color else VMobject().color │
│ ❱ 486 │ │ file_name = self.text2svg(color) │
│ 487 │ │ PangoUtils.remove_last_M(file_name) │
│ 488 │ │ super().init( │
│ 489 │ │ │ file_name, │
│ │
│ /Blah/lib/python3.10/site-packages/manim/mobject/text/text

│ mobject.py:814 in _text2svg │
│ │
│ 811 │ │ │ width = config["pixel_width"] │
│ 812 │ │ │ height = config["pixel_height"] │
│ 813 │ │ │ │
│ ❱ 814 │ │ │ svg_file = manimpango.text2svg( │
│ 815 │ │ │ │ settings, │
│ 816 │ │ │ │ size, │
│ 817 │ │ │ │ line_spacing, │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
TypeError: Argument 'size' has incorrect type (expected int, got float)

Misplacement of connections between neurons in NeuralNetworkScene

I tried to run the example code below:

class NeuralNetworkScene(Scene):
    def construct(self):
        layers = [FeedForwardLayer(3), FeedForwardLayer(5), FeedForwardLayer(3)]
        nn = NeuralNetwork(layers)
        self.add(nn)
        nn.move_to(ORIGIN)
        # nn.scale(2)
        forward_propagation_animation = nn.make_forward_pass_animation(
            run_time=5, passing_flash=True
        )
        self.play(forward_propagation_animation)

And everything is fine.
But when I uncomment nn.scale(2), this happened:
image
It appears that the connections between neurons are misplaced when scaling.

correct the "First Neural Network" code

Thank you for sharing your job! @helblazer811

The second line of the "First Neural Network"

from manim_ml.neural_network import Convolutional2DLayer, FeedForwardLayer, NeuralNetwork

should be changed as

from manim_ml.neural_network.layers import  Convolutional2DLayer, FeedForwardLayer
from manim_ml.neural_network.neural_network import NeuralNetwork

I hope this project gets better and better.

Nested Neural Networks

It would be nice to allow a user to pass a neural network into another neural network and have it be treated as a layer when constructing animations or renderings. It could look something like:

nested_network = NeuralNetwork([
     ImageLayer(),
     NeuralNetwork([
           Convolutional3DLayer(),
           Convolutional3DLayer(),
     ])
     FeedForwardLayer()
])

Activation Functions

I want to visualize activation functions. I can envision two different ways of doing this.

  1. Show activation functions as their own layer.
  2. Show activation functions above existing layers with a certain symbol.

I am in favor of showing the activation function above existing layers because it will not interfere with existing visualizations like FeedForwardToFeedForward Convolutional3dToConvolutional3D.

A possible way to allow for this would to be to add a string optional parameter to layers like FeedForward and Convolutional3d.

nn = NeuralNetwork([
      ImageLayer(numpy_image, height=1.5),
      Convolutional3DLayer(1, 7, 7, 3, 3, filter_spacing=0.32, activation="relu"),
      Convolutional3DLayer(3, 5, 5, 3, 3, filter_spacing=0.32, activation="relu"),
      FeedForwardLayer(3, activation="sigmoid"),
    ],
    layer_spacing=0.25,
)

Another way of doing it could be to pass a function or callable object (the callable object could also have a name) instead of a string, which would allow for custom activation functions.

def step_function(input):
    return 0 if input < 0 else return 1

nn = NeuralNetwork([
      ImageLayer(numpy_image, height=1.5),
      Convolutional3DLayer(1, 7, 7, 3, 3, filter_spacing=0.32, activation=step_function),
      Convolutional3DLayer(3, 5, 5, 3, 3, filter_spacing=0.32, activation="relu"),
      FeedForwardLayer(3, activation="sigmoid"),
    ],
    layer_spacing=0.25,
)

A small coordinate frame with a function visualization can be shown above the layer that is being "activated" and that small function can be highlighted whenever there is a forward pass.

Clean up the namespace for layers

It would be nice if I could import a bunch of layers from one namespace file instead of from each of the files individually,
this would shorten the length of the imports at the beginning of files.

missing "config"

Hi, when I was trying to run the maxpooling example in 0.0.24 it gave me an AttributeError:

convolutional_2d_to_max_pooling_2d.py:170 in make_forward_pass_animation │
│ ❱ 170 │ │ │ │ axis=manim_ml.three_d_config.rotation_axis, │

I think it would be axis=manim_ml.config.three_d_config.rotation_axis

BTW, just wondering is it possible to specify the run_time of each layer? sometimes the ImageLayer plays very fast but Convolutional2DLayer plays too slow.

Wrong Image to Conv Animation

Hello I've got an issue with Image to Convolutional 2D . I took the cnn example and changed the Neural Network to:

nn = NeuralNetwork(
            [
                ImageLayer(numpy_image, height=1.5),
                Convolutional2DLayer(1, 16, 3, activation_function="ReLU"),
                #Convolutional2DLayer(3, 5, 3, filter_spacing=0.32),
                #Convolutional2DLayer(5, 3, 3, filter_spacing=0.18),
                #FeedForwardLayer(3),
                #FeedForwardLayer(3),
            ],
            layer_spacing=0.25,
        )

when I run the code the image rotation / scaling is somehow wrong. Maybe you guys know what the problem could be.
image

Allow for passing layers as a dictionary.

Allow for passing layers as a dictionary as follows:

nn = NeuralNetwork({
    "image_layer": ImageLayer(numpy_image, height=1.5),
    "conv_1_layer": Convolutional2DLayer(1, 7, 3, filter_spacing=0.32),
    "feed_forward_1_layer": FeedForwardLayer(3),
  },
  layer_spacing=0.25,
)

The main purpose of this is so that we can add operations later on that reference the layers by name like adding a residual connection nn.add_connection("image_layer", "feed_forward_1_layer").

Dropout Last Layer - Should have option to remove node removal

During certain tasks, the terminating layer of the neural network does not have Dropouts applied to the last layer; however, here, I wasn't able to directly find a method to prevent it. All FeedForwards are considered the same.

Can there be an argument like:

make_neural_network_dropout_animation(
                nn, dropout_rate=0.75, do_forward_pass=True, last_layer_stable=True
            )

Would like to explore the same with the first feed-forward layer and seeding the probability distribution

Residual Connections

I would like to add support for residual connections (ResNet) to the neural network rendering system.

filename change in layers

after installing manim_ml on my anaconda env, i noticed that the import in the example
from manim_ml.neural_network.layers.convolutional_2d import Convolutional2DLayer

didn't work. After digging into the site packages, and locating why the rest of the imports due work i found that it was because the file is called convolutional2d.py and not convolutional_2d.py making this import in the example not work. Seems the pip build has a different name for this file

I checked by reinstalling the latest build from pip on 26.01.2023.

ManimML in docker

Hello,
it is possible to install ManimML in the docker Manim community docker in the jupyter notebook?

NN scaling issue with Convolutional3DLayer

At some point there was code commited changing the behaviour of the net when scaling it.
If I use the code in the pip package everything works fine (0.0.11 seems to contain only code prior to the 7th of may).
https://user-images.githubusercontent.com/54776552/198372984-f704cceb-8582-4bf9-bc23-c15ebb836b34.mp4

However I'm forking the repo (with the latest commit from august) because I need to change some internal code and noticed this problem.

Test.mp4

Maybe someone can pinpoint the exact commit which causes this behaviour?

Code used:

class Test(Scene):
	def construct(self):
		# Make the Layer object
		l1 = Convolutional3DLayer(4, 2, 2)
		l2 = Convolutional3DLayer(5, 1, 1)
		l3 = Convolutional3DLayer(2, 3, 3)
		layers = [l1, l2, l3]
		nn = NeuralNetwork(layers)
		nn.scale(2)
		nn.move_to(ORIGIN)
		# Make Animation
		self.add(nn)
		#self.play(Create(nn))
		forward_propagation_animation = nn.make_forward_pass_animation(run_time=5, passing_flash=True)

		self.play(forward_propagation_animation)

Quad Tree Barnes-Hut Visualization

I want to visualize quad trees used in pairwise force calculations for Barnes-Hut simulations of things like force diagrams and n-bodies simulations.

PyPi out of date

When I pip install manim_ml it doesn't include any of the examples in the README. It also doesn't have many of the modules you'd expect. For example, manim_ml.neural_networks doesn't exist. As a workaround I've manually installed dependencies and added a clone of the latest commit to my python path. However, it would be nice to be able to install it via pip.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.