General changes, got basic visualization of an activation function working for a

convolutinoal layer.
This commit is contained in:
Alec Helbling
2023-01-24 15:44:48 -05:00
parent 5291d9db8a
commit ce184af78e
34 changed files with 1575 additions and 479 deletions

View File

@ -19,12 +19,36 @@ class CombinedScene(ThreeDScene):
image = Image.open("../assets/mnist/digit.jpeg")
numpy_image = np.asarray(image)
# Make nn
nn = NeuralNetwork(
[
nn = NeuralNetwork([
ImageLayer(numpy_image, height=1.5),
Convolutional2DLayer(1, 8, 8, 3, 3, filter_spacing=0.32),
Convolutional2DLayer(1, 8, filter_spacing=0.32),
MaxPooling2DLayer(kernel_size=2),
Convolutional2DLayer(3, 3, 2, filter_spacing=0.32),
],
layer_spacing=0.25,
)
# Center the nn
nn.move_to(ORIGIN)
self.add(nn)
self.wait(5)
# Play animation
forward_pass = nn.make_forward_pass_animation(
corner_pulses=False, all_filters_at_once=False
)
print(forward_pass)
print(forward_pass.animations)
self.wait(1)
self.play(forward_pass)
class SmallNetwork(ThreeDScene):
def construct(self):
image = Image.open("../assets/mnist/digit.jpeg")
numpy_image = np.asarray(image)
# Make nn
nn = NeuralNetwork([
ImageLayer(numpy_image, height=1.5),
Convolutional2DLayer(1, 8, filter_spacing=0.32),
MaxPooling2DLayer(kernel_size=2),
Convolutional2DLayer(3, 5, 5, 3, 3, filter_spacing=0.32),
],
layer_spacing=0.25,
)
@ -36,4 +60,4 @@ class CombinedScene(ThreeDScene):
corner_pulses=False, all_filters_at_once=False
)
self.wait(1)
self.play(forward_pass)
self.play(forward_pass)