import os

import numpy as np
import matplotlib.pyplot as plt

import tensorflow as tf
from tensorflow.keras.utils import to_categorical
from tensorflow.keras.datasets import mnist
from tensorflow.keras.layers import *
from tensorflow.keras.activations import *
from tensorflow.keras.models import *
from tensorflow.keras.optimizers import *
from tensorflow.keras.initializers import *

np.random.seed(42)

# Load MNIST dataset
(x_train, y_train), (x_test, y_test) = mnist.load_data()

image = x_train[0]
image = image.reshape((28, 28))

kernel = np.random.uniform(low=0.0, high=1.0, size=(2,2))

# Stride (1,1)
# Conv Funktion definieren und anschließend plotten
def conv2D(image, kernel):
    return image

conv_image = conv2D(image, kernel)

# Input und Outputbild des Pooling Layers mit imshow() ausgeben
plt.imshow(image, cmap="gray")
plt.show()

plt.imshow(conv_image, cmap="gray")
plt.show()
3f2d9f79defbd871d1b85440997e07023927096a
<mask token>


def conv2D(image, kernel):
    return image


<mask token>

<mask token>
np.random.seed(42)
<mask token>


def conv2D(image, kernel):
    return image


<mask token>
plt.imshow(image, cmap='gray')
plt.show()
plt.imshow(conv_image, cmap='gray')
plt.show()

<mask token>
np.random.seed(42)
(x_train, y_train), (x_test, y_test) = mnist.load_data()
image = x_train[0]
image = image.reshape((28, 28))
kernel = np.random.uniform(low=0.0, high=1.0, size=(2, 2))


def conv2D(image, kernel):
    return image


conv_image = conv2D(image, kernel)
plt.imshow(image, cmap='gray')
plt.show()
plt.imshow(conv_image, cmap='gray')
plt.show()

import os
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
from tensorflow.keras.utils import to_categorical
from tensorflow.keras.datasets import mnist
from tensorflow.keras.layers import *
from tensorflow.keras.activations import *
from tensorflow.keras.models import *
from tensorflow.keras.optimizers import *
from tensorflow.keras.initializers import *
np.random.seed(42)
(x_train, y_train), (x_test, y_test) = mnist.load_data()
image = x_train[0]
image = image.reshape((28, 28))
kernel = np.random.uniform(low=0.0, high=1.0, size=(2, 2))


def conv2D(image, kernel):
    return image


conv_image = conv2D(image, kernel)
plt.imshow(image, cmap='gray')
plt.show()
plt.imshow(conv_image, cmap='gray')
plt.show()

import os

import numpy as np
import matplotlib.pyplot as plt

import tensorflow as tf
from tensorflow.keras.utils import to_categorical
from tensorflow.keras.datasets import mnist
from tensorflow.keras.layers import *
from tensorflow.keras.activations import *
from tensorflow.keras.models import *
from tensorflow.keras.optimizers import *
from tensorflow.keras.initializers import *

np.random.seed(42)

# Load MNIST dataset
(x_train, y_train), (x_test, y_test) = mnist.load_data()

image = x_train[0]
image = image.reshape((28, 28))

kernel = np.random.uniform(low=0.0, high=1.0, size=(2,2))

# Stride (1,1)
# Conv Funktion definieren und anschließend plotten
def conv2D(image, kernel):
    return image

conv_image = conv2D(image, kernel)

# Input und Outputbild des Pooling Layers mit imshow() ausgeben
plt.imshow(image, cmap="gray")
plt.show()

plt.imshow(conv_image, cmap="gray")
plt.show()