CNN and RNN for Image Recognition
CNN and RNN for Image Recognition
EXPERIMENT - 1
AIM:Build a Convolution Neural Network for Image Recognition. Go through the modules of
the course mentioned and answer the self-assessment questions given in the link below at the end
of the course.
program
OUTPUT
Epoch 1/10
1563/1563━━━━━━━━━━━━━━━━━━━━13s 6ms/step - accuracy: 0.3648
- loss: 1.7232 - val_accuracy: 0.5743 - val_loss: 1.2208
Epoch 2/10
1563/1563━━━━━━━━━━━━━━━━━━━━6s 4ms/step - accuracy: 0.5882
- loss: 1.1565 - val_accuracy: 0.6341 - val_loss: 1.0557
Epoch 3/10
1563/1563━━━━━━━━━━━━━━━━━━━━6s 4ms/step - accuracy: 0.6514
- loss: 0.9898 - val_accuracy: 0.6540 - val_loss: 0.9883
Epoch 4/10
1563/1563━━━━━━━━━━━━━━━━━━━━7s 4ms/step - accuracy: 0.6996
- loss: 0.8680 - val_accuracy: 0.6887 - val_loss: 0.8978
Epoch 5/10
1563/1563━━━━━━━━━━━━━━━━━━━━6s 4ms/step - accuracy: 0.7212
- loss: 0.8004 - val_accuracy: 0.6914 - val_loss: 0.8956
Epoch 6/10
1563/1563━━━━━━━━━━━━━━━━━━━━8s 5ms/step - accuracy: 0.7456
- loss: 0.7277 - val_accuracy: 0.6622 - val_loss: 0.9708
Epoch 7/10
1563/1563━━━━━━━━━━━━━━━━━━━━9s 4ms/step - accuracy: 0.7578
- loss: 0.6960 - val_accuracy: 0.7057 - val_loss: 0.8554
Epoch 8/10
1563/1563━━━━━━━━━━━━━━━━━━━━6s 4ms/step - accuracy: 0.7781
- loss: 0.6353 - val_accuracy: 0.7212 - val_loss: 0.8352
Epoch 9/10
1563/1563━━━━━━━━━━━━━━━━━━━━6s 4ms/step - accuracy: 0.7885
- loss: 0.6022 - val_accuracy: 0.7098 - val_loss: 0.8723
Epoch 10/10
1563/1563━━━━━━━━━━━━━━━━━━━━10s 4ms/step - accuracy: 0.8027
- loss: 0.5620 - val_accuracy: 0.7116 - val_loss: 0.890
EXPERIMENT-2
AIM :Module name : Understanding and Using ANN : Identifying age group of an actor
Exercise : Design Artificial Neural Networks for Identifying and Classifying an actor using
Kaggle Dataset.
Program
OUTPUT :-
[Link](87kB)
━━━━━━━━━━━━━━━━━━━━━━━━87.2/87.2 kB4.9 MB/s eta 0:00:00
25-08-05 04:45:45 - Directory /root/.deepface has been created
25-08-05 04:45:45 - Directory /root/.deepface/weights has been created
Downloading...
From:
[Link]
weights.h5
To: /root/.deepface/weights/age_model_weights.h5
25-08-05 04:46:16 - ◻ age_model_weights.h5 will be downloaded from
[Link]
weights.h5 to /root/.deepface/weights/age_model_weights.h5...
100%|██████████| 539M/539M [00:01<00:00, 303MB/s]
predicted age:26
age group:younger
EXPERIMENT-3
Program
import tensorflow as tf
from [Link] import cifar10
from [Link] import Sequential
from [Link] import Conv2D, MaxPooling2D, Flatten, Dense
import [Link] as plt
import numpy as np
(x_train, y_train), (x_test, y_test) = cifar10.load_data()
x_train, x_test = x_train/255.0, x_test/255.0
y_train_cat = [Link].to_categorical(y_train,10)
y_test_cat = [Link].to_categorical(y_test,10)
model = Sequential([
Conv2D(32,(3,3),activation='relu',input_shape=(32,32,3)),
MaxPooling2D(2,2),
Conv2D(64,(3,3),activation='relu'),
MaxPooling2D(2,2),
Flatten(),
Dense(128,activation='relu'),
Dense(10,activation='softmax')
])
[Link](optimizer='adam', loss='categorical_crossentropy',
metrics=['accuracy'])
[Link](x_train, y_train_cat, epochs=3, validation_split=0.2)
preds = [Link](x_test)
pred_labels = [Link](preds, axis=1)
classes =
['airplane','automobile','bird','cat','deer','dog','frog','horse','ship','
truck']
[Link](figsize=(12,6))
shown_classes = set()
i = 0
whilelen(shown_classes) <10and i <len(x_test):
true_class = int(y_test[i])
if true_class notin shown_classes:
[Link](2,5,len(shown_classes)+1)
[Link](x_test[i])
[Link](f"Pred: {classes[pred_labels[i]]}\nTrue:
{classes[true_class]}")
[Link]('off')
shown_classes.add(true_class)
i += 1
[Link]()
OUTPUT
Epoch 1/3
1250/1250━━━━━━━━━━━━━━━━━━━━9s 6ms/step - accuracy: 0.3892 -
loss: 1.6867 - val_accuracy: 0.5680 - val_loss: 1.2325
Epoch 2/3
1250/1250━━━━━━━━━━━━━━━━━━━━5s 4ms/step - accuracy: 0.5911 -
loss: 1.1568 - val_accuracy: 0.6154 - val_loss: 1.1027
Epoch 3/3
1250/1250━━━━━━━━━━━━━━━━━━━━6s 4ms/step - accuracy: 0.6498 -
loss: 0.9981 - val_accuracy: 0.6452 - val_loss: 1.0122
313/313━━━━━━━━━━━━━━━━━━━━1s 2ms/step
EXPERIMENT-4
Program
import numpy as np
import tensorflow as tf
from [Link] import Sequential
from [Link] import LSTM, Dense
import [Link] as plt
defgenerate_sine_wave(length, frequency, amplitude, noise_level=0.1):
x = [Link](0, length)
sine_wave = amplitude * [Link](2 * [Link] * frequency * x / length)
noise = [Link](0, noise_level, length)
return sine_wave + noise
data_length = 100
time_series_data = generate_sine_wave(data_length, frequency=5,
amplitude=1)
defcreate_sequences(data, n_steps):
X, y = [], []
for i inrange(len(data) - n_steps):
seq = data[i:i + n_steps]
target = data[i + n_steps]
[Link](seq)
[Link](target)
return [Link](X), [Link](y)
n_steps = 10
X, y = create_sequences(time_series_data, n_steps)
X = [Link](([Link][0], [Link][1], 1))
print(f"Shape of X (input sequences): {[Link]}")
print(f"Shape of y (target values): {[Link]}\n")
model = Sequential()
[Link](LSTM(50, activation='relu', input_shape=(n_steps, 1)))
[Link](Dense(1))
[Link](optimizer='adam', loss='mean_squared_error')
[Link]()
history = [Link](X, y, epochs=200, verbose=0, validation_split=0.2)
print("\nModel training complete.")
train_predictions = [Link](X, verbose=0).flatten()
last_sequence = time_series_data[-n_steps:]
last_sequence = last_sequence.reshape((1, n_steps, 1))
future_predictions = []
current_input = last_sequence
for _ inrange(20):
next_value = [Link](current_input, verbose=0)[0]
future_predictions.append(next_value[0])
current_input = [Link](current_input[:, 1:, :], [[next_value]],
axis=1)
[Link](figsize=(14, 8))
[Link]([Link](data_length), time_series_data, label='Original Data',
color='blue', linewidth=2)
[Link]([Link](n_steps, data_length), train_predictions, label='In-
Sample Predictions', color='orange', linestyle='--', linewidth=2)
prediction_range = [Link](data_length, data_length +
len(future_predictions))
[Link](prediction_range, future_predictions, label='Future Predictions',
color='red', linestyle='--', linewidth=2)
[Link](x=data_length - 1, color='gray', linestyle='--', linewidth=1)
[Link]("Sequential Data Prediction using an LSTM Network")
[Link]("Time Step")
[Link]("Value")
[Link]()
[Link](True)
[Link]()
OUTPUT
Shape of X (input sequences): (90, 10, 1)
Shape of y (target values): (90,)
EXPERIMENT-5
AIM :Module Name: Removing noise from the images Exercise: Implement
Multi-Layer Perceptron algorithm for Image denoising hyperparameter tuning
Program
import numpy as np
import [Link] as plt
from [Link] import Sequential
from [Link] import Dense
from [Link] import mnist
from [Link] import Adam
from [Link] import EarlyStopping
(x_train, _), (x_test, _) = mnist.load_data()
x_train = x_train.astype('float32') / 255.
x_test = x_test.astype('float32') / 255.
x_train_flat = x_train.reshape((len(x_train), [Link](x_train.shape[1:])))
x_test_flat = x_test.reshape((len(x_test), [Link](x_test.shape[1:])))
noise_factor = 0.5
x_train_noisy = x_train_flat + noise_factor * [Link](loc=0.0,
scale=1.0, size=x_train_flat.shape)
x_test_noisy = x_test_flat + noise_factor * [Link](loc=0.0,
scale=1.0, size=x_test_flat.shape)
x_train_noisy = [Link](x_train_noisy, 0., 1.)
x_test_noisy = [Link](x_test_noisy, 0., 1.)
input_dim = x_train_flat.shape[1]
model = Sequential()
[Link](Dense(256, activation='relu', input_shape=(input_dim,)))
[Link](Dense(128, activation='relu'))
[Link](Dense(256, activation='relu'))
[Link](Dense(input_dim, activation='sigmoid'))
[Link](optimizer=Adam(learning_rate=0.001),
loss='mean_squared_error')
[Link]()
early_stopping = EarlyStopping(monitor='val_loss', patience=5,
restore_best_weights=True)
history = [Link](
x_train_noisy,
x_train_flat,
epochs=10,
batch_size=256,
shuffle=True,
validation_split=0.2,
callbacks=[early_stopping]
)
[Link](figsize=(10, 6))
[Link]([Link]['loss'], label='Training Loss')
[Link]([Link]['val_loss'], label='Validation Loss')
[Link]('Model Loss over Epochs')
[Link]('Epochs')
[Link]('Loss')
[Link]()
[Link]()
denoised_images = [Link](x_test_noisy)
n = 10
[Link](figsize=(20, 6))
for i inrange(n):
ax = [Link](3, n, i + 1)
[Link](x_test[i].reshape(28, 28))
[Link]('Original')
[Link]()
ax.get_xaxis().set_visible(False)
ax.get_yaxis().set_visible(False)
ax = [Link](3, n, i + 1 + n)
[Link](x_test_noisy[i].reshape(28, 28))
[Link]('Noisy')
[Link]()
ax.get_xaxis().set_visible(False)
ax.get_yaxis().set_visible(False)
ax = [Link](3, n, i + 1 + 2*n)
[Link](denoised_images[i].reshape(28, 28))
[Link]('Denoised')
[Link]()
ax.get_xaxis().set_visible(False)
ax.get_yaxis().set_visible(False)
[Link]()
OUTPUT
11490434/11490434━━━━━━━━━━━━━━━━━━━━ 0s 0us/step
Epoch 1/10
188/188━━━━━━━━━━━━━━━━━━━━7s 28ms/step - loss: 0.0871 -
val_loss: 0.0370
Epoch 2/10
188/188━━━━━━━━━━━━━━━━━━━━4s 21ms/step - loss: 0.0332 -
val_loss: 0.0268
Epoch 3/10
188/188━━━━━━━━━━━━━━━━━━━━5s 25ms/step - loss: 0.0254 -
val_loss: 0.0232
Epoch 4/10
188/188━━━━━━━━━━━━━━━━━━━━4s 21ms/step - loss: 0.0222 -
val_loss: 0.0212
Epoch 5/10
188/188━━━━━━━━━━━━━━━━━━━━5s 21ms/step - loss: 0.0203 -
val_loss: 0.0199
Epoch 6/10
188/188━━━━━━━━━━━━━━━━━━━━5s 21ms/step - loss: 0.0190 -
val_loss: 0.0191
Epoch 7/10
188/188━━━━━━━━━━━━━━━━━━━━4s 21ms/step - loss: 0.0182 -
val_loss: 0.0183
Epoch 8/10
188/188━━━━━━━━━━━━━━━━━━━━4s 23ms/step - loss: 0.0174 -
val_loss: 0.0177
Epoch 9/10
EXPERIMENT-6
AIM :Module Name: Advanced Deep Learning Architectures Exercise: Implement Object Dection
Using YOLO
Program
OUTPUT
EXPERIMENT – 7
AIM: Module Name: Optimization of Training in Deep Learning ,Exercise Name: Design a Deep
learning Network for Robust Bi-Tempered Logistic Loss.\
Program
import torch
import [Link] as nn
import [Link] as F
def bi_tempered_logistic_loss(logits, labels, t1=0.8, t2=1.2,
label_smoothing=0.0):
if label_smoothing > 0.0:
smooth_labels = (1.0 - label_smoothing) * labels + label_smoothing
/ [Link](1)
else:
smooth_labels = labels
exp_t1 = 1.0 / (t1 - 1.0)
tempered_logits = [Link]([Link]([Link](logits, dim=-1),
min=1e-9), exp_t1)
exp_t2 = 1.0 / (t2 - 1.0)
tempered_log_probs = [Link]([Link](F.log_softmax(logits, dim=-
1), min=1e-9), exp_t2)
loss = tempered_log_probs * smooth_labels
loss = -[Link](loss, dim=-1)
return [Link](loss)
import torch
import [Link] as nn
class SimpleNet([Link]):
def init (self, input_size, num_classes):
super(SimpleNet, self). init ()
self.fc1 = [Link](input_size, 128)
[Link] = [Link]()
self.fc2 = [Link](128, num_classes)
def forward(self, x):
x = self.fc1(x)
x = [Link](x)
x = self.fc2(x)
return x
input_size = 784
num_classes = 10
model = SimpleNet(input_size, num_classes)
batch_size = 64
dummy_input = [Link](batch_size, input_size)
OUTPUT
EXPERIMENT – 8
AIM :- Module name: Advanced CNN ,Exercise: Build AlexNet using Advanced CNN.
Program
import tensorflow as tf
from [Link] import Sequential
from [Link] import Conv2D, MaxPooling2D, Flatten, Dense,
Dropout, BatchNormalization, Input
def build_alexnet(input_shape=(224, 224, 3), num_classes=1000):
model = Sequential([
Input(shape=input_shape),
Conv2D(96, (11, 11), strides=(4, 4), activation='relu'),
BatchNormalization(),
MaxPooling2D((3, 3), strides=(2, 2)),
Conv2D(256, (5, 5), padding='same', activation='relu'),
BatchNormalization(),
MaxPooling2D((3, 3), strides=(2, 2)),
Conv2D(384, (3, 3), padding='same', activation='relu'),
BatchNormalization(),
Conv2D(384, (3, 3), padding='same', activation='relu'),
BatchNormalization(),
Conv2D(256, (3, 3), padding='same', activation='relu'),
BatchNormalization(),
MaxPooling2D((3, 3), strides=(2, 2)),
Flatten(),
Dense(4096, activation='relu'),
Dropout(0.5),
Dense(4096, activation='relu'),
Dropout(0.5),
Dense(num_classes, activation='softmax')
])
return model
alexnet_model = build_alexnet()
alexnet_model.summary()
OUTPUT
EXPERIMENT – 9
Program
OUT PUT
Epoch 1/3
235/235 ━━━━━━━━━━━━━━━━━━━━ 6s 18ms/step - loss: 0.4617 -
val_loss: 0.3180
Epoch 2/3
235/235 ━━━━━━━━━━━━━━━━━━━━ 5s 20ms/step - loss: 0.3129 -
val_loss: 0.3072
Epoch 3/3
235/235 ━━━━━━━━━━━━━━━━━━━━ 4s 18ms/step - loss: 0.3036 -
val_loss: 0.3010
313/313 ━━━━━━━━━━━━━━━━━━━━ 1s 3ms/step - loss: 0.3008
EXPERIMENT – 10
Program
import tensorflow as tf
from [Link] import layers
import numpy as np
import [Link] as plt
(X_train, _), (_, _) = [Link].load_data()
X_train = (X_train.astype(np.float32) - 127.5) / 127.5
X_train = X_train.reshape(X_train.shape[0], 28, 28, 1)
BUFFER_SIZE = 60000
BATCH_SIZE = 256
train_dataset =
[Link].from_tensor_slices(X_train).shuffle(BUFFER_SIZE).batch(BAT
CH_SIZE)
def make_generator_model():
model = [Link]([
[Link](7*7*256, use_bias=False, input_shape=(100,)),
[Link](),
[Link](),
[Link]((7, 7, 256)),
layers.Conv2DTranspose(128, (5, 5), strides=(1, 1),
padding='same', use_bias=False),
[Link](),
[Link](),
layers.Conv2DTranspose(64, (5, 5), strides=(2, 2), padding='same',
use_bias=False),
[Link](),
[Link](),
layers.Conv2DTranspose(1, (5, 5), strides=(2, 2), padding='same',
use_bias=False, activation='tanh')
])
return model
def make_discriminator_model():
model = [Link]([
layers.Conv2D(64, (5, 5), strides=(2, 2), padding='same',
input_shape=[28, 28, 1]),
[Link](),
[Link](0.3),
layers.Conv2D(128, (5, 5), strides=(2, 2), padding='same'),
[Link](),
[Link](0.3),
[Link](),
[Link](1)
])
return model
cross_entropy = [Link](from_logits=True)
def discriminator_loss(real_output, fake_output):
real_loss = cross_entropy(tf.ones_like(real_output), real_output)
fake_loss = cross_entropy(tf.zeros_like(fake_output), fake_output)
return real_loss + fake_loss
def generator_loss(fake_output):
return cross_entropy(tf.ones_like(fake_output), fake_output)
generator_optimizer = [Link](1e-4)
discriminator_optimizer = [Link](1e-4)
@[Link]
def train_step(images, generator, discriminator):
noise = [Link]([BATCH_SIZE, 100])
with [Link]() as gen_tape, [Link]() as disc_tape:
generated_images = generator(noise, training=True)
real_output = discriminator(images, training=True)
fake_output = discriminator(generated_images, training=True)
gen_loss = generator_loss(fake_output)
disc_loss = discriminator_loss(real_output, fake_output)
gradients_of_generator = gen_tape.gradient(gen_loss,
generator.trainable_variables)
gradients_of_discriminator = disc_tape.gradient(disc_loss,
discriminator.trainable_variables)
generator_optimizer.apply_gradients(zip(gradients_of_generator,
generator.trainable_variables))
discriminator_optimizer.apply_gradients(zip(gradients_of_discriminator,
discriminator.trainable_variables))
def generate_and_save_images(model, epoch, test_input):
predictions = model(test_input, training=False)
predictions = 0.5 * predictions + 0.5
fig = [Link](figsize=(4, 4))
for i in range(16): # Show 16 images
[Link](4, 4, i + 1)
[Link](predictions[i, :, :, 0], cmap='gray')
[Link]('off')
[Link](f'Generated Images - Epoch {epoch}')
[Link]()
def train(dataset, epochs):
seed = [Link]([16, 100])
generator = make_generator_model()
discriminator = make_discriminator_model()
for epoch in range(epochs):
OUTPUT
EXPERIMENT – 11
AIM: - Module name : Capstone project , Exercise : Complete the requirements given in
capstone project ,Description: In this capstone, learners will apply their deep learning knowledge
and expertise to a real world challenge.
Program
import tensorflow as tf
from [Link] import layers
from [Link] import imdb
from [Link] import pad_sequences
from [Link] import Sequential
from [Link] import EarlyStopping
import numpy as np
import [Link] as plt
from [Link] import classification_report, confusion_matrix
import seaborn as sns
print("Loading IMDb dataset...")
max_features = 10000
maxlen = 200
(x_train, y_train), (x_test, y_test) =
imdb.load_data(num_words=max_features)
x_train = pad_sequences(x_train, maxlen=maxlen)
x_test = pad_sequences(x_test, maxlen=maxlen)
print(f"Data: Train {x_train.shape}, Test {x_test.shape}")
model = Sequential([
[Link](max_features, 128, input_length=maxlen),
[Link](64, dropout=0.2, recurrent_dropout=0.2),
[Link](1, activation='sigmoid')
])
[Link](optimizer='adam', loss='binary_crossentropy',
metrics=['accuracy'])
EPOCHS = 3
BATCH_SIZE = 32
early_stop = EarlyStopping(monitor='val_loss', patience=2,
restore_best_weights=True)
history = [Link](x_train, y_train, epochs=EPOCHS,
batch_size=BATCH_SIZE,
validation_split=0.2, callbacks=[early_stop],
verbose=1)
test_loss, test_acc = [Link](x_test, y_test, verbose=0)
print(f"Test Accuracy: {test_acc:.4f}")
y_pred = ([Link](x_test) > 0.5).astype(int)
print("\nClassification Report:")
OUTPUT
Loading IMDb dataset...
Downloading data from [Link]
datasets/[Link]
17464789/17464789 ━━━━━━━━━━━━━━━━━━━━ 0s 0us/step
Data: Train (25000, 200), Test (25000, 200)
/usr/local/lib/python3.12/dist-
packages/keras/src/layers/core/[Link]: UserWarning: Argument
`input_length` is deprecated. Just remove it.
[Link](
Epoch 1/5
625/625 ━━━━━━━━━━━━━━━━━━━━ 255s 391ms/step - accuracy:
0.7119 - loss: 0.5576 - val_accuracy: 0.8314 - val_loss: 0.3894
Epoch 2/5
625/625 ━━━━━━━━━━━━━━━━━━━━ 238s 381ms/step - accuracy:
0.8416 - loss: 0.3635 - val_accuracy: 0.8422 - val_loss: 0.3764
Epoch 3/5
625/625 ━━━━━━━━━━━━━━━━━━━━ 238s 380ms/step - accuracy:
0.8897 - loss: 0.2795 - val_accuracy: 0.8236 - val_loss: 0.4540
Epoch 4/5
625/625 ━━━━━━━━━━━━━━━━━━━━ 236s 378ms/step - accuracy:
0.9068 - loss: 0.2376 - val_accuracy: 0.8546 - val_loss: 0.3615
Epoch 5/5
625/625 ━━━━━━━━━━━━━━━━━━━━ 239s 383ms/step - accuracy:
0.9231 - loss: 0.2038 - val_accuracy: 0.8316 - val_loss: 0.3995
Classification Report:
Sample Predictions:
1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 220ms/step
WARNING:absl:You are saving your model as an HDF5 file via `[Link]()` or
`[Link].save_model(model)`. This file format is considered legacy. We
recommend using instead the native Keras format, e.g.
`[Link]('my_model.keras')` or `[Link].save_model(model,
'my_model.keras')`.
'This product is amazing and works perfectly!' → Positive (Conf: 0.69)
'Terrible quality, broke after one use.' → Positive (Conf: 0.78)
'Okay, but could be better for the price.' → Positive (Conf: 0.61)
Model saved as 'simple_sentiment_model.h5'
EXPERIMENT – 12
AIM:- Module name : Capstone project , Exercise : Complete the requirements given in capstone
project
Program
import tensorflow as tf
from tensorflow import keras
from [Link] import layers
import numpy as np
import [Link] as plt
(x_train, y_train), (x_test, y_test) = [Link].load_data()
x_train = x_train / 255.0
x_test = x_test / 255.0
x_train = x_train.reshape(-1, 28, 28, 1)
x_test = x_test.reshape(-1, 28, 28, 1)
model = [Link]([
layers.Conv2D(32, kernel_size=(3, 3), activation='relu',
input_shape=(28, 28, 1)),
layers.MaxPooling2D(pool_size=(2, 2)),
[Link](),
[Link](128, activation='relu'),
[Link](10, activation='softmax')])
[Link](optimizer='adam',
loss='sparse_categorical_crossentropy',
metrics=['accuracy'])
history = [Link](x_train, y_train, epochs=5, validation_split=0.2)
test_loss, test_acc = [Link](x_test, y_test)
print(f"\nTest accuracy: {test_acc * 100:.2f}%")
predictions = [Link](x_test)
def plot_sample(index):
[Link](x_test[index].reshape(28, 28), cmap='gray')
[Link](f"Predicted: {[Link](predictions[index])}, Actual:
{y_test[index]}")
[Link]()
plot_sample(0)
[Link]('capstone_mnist_model.h5')
print("Model saved as 'capstone_mnist_model.h5'")
[Link]([Link]['accuracy'], label='Training Accuracy')
[Link]([Link]['val_accuracy'], label='Validation Accuracy')
[Link]('Epochs')
[Link]('Accuracy')
[Link]()
[Link]()
OUTPUT
/usr/local/lib/python3.12/dist-
packages/keras/src/layers/convolutional/base_conv.py:113: UserWarning: Do not
pass an `input_shape`/`input_dim` argument to a layer. When using Sequential
models, prefer using an `Input(shape)` object as the first layer in the model
[Link](). init (activity_regularizer=activity_regularizer,
**kwargs)
Epoch 1/5
1500/1500 ━━━━━━━━━━━━━━━━━━━━ 9s 4ms/step - accuracy: 0.8977 -
loss: 0.3332 - val_accuracy: 0.9794 - val_loss: 0.0707
Epoch 2/5
1500/1500 ━━━━━━━━━━━━━━━━━━━━ 5s 3ms/step - accuracy: 0.9829 -
loss: 0.0538 - val_accuracy: 0.9801 - val_loss: 0.0638
Epoch 3/5
1500/1500 ━━━━━━━━━━━━━━━━━━━━ 5s 3ms/step - accuracy: 0.9893 -
loss: 0.0343 - val_accuracy: 0.9822 - val_loss: 0.0590
Epoch 4/5
1500/1500 ━━━━━━━━━━━━━━━━━━━━ 5s 3ms/step - accuracy: 0.9931 -
loss: 0.0222 - val_accuracy: 0.9841 - val_loss: 0.0500
Epoch 5/5
1500/1500 ━━━━━━━━━━━━━━━━━━━━ 4s 3ms/step - accuracy: 0.9962 -
loss: 0.0125 - val_accuracy: 0.9836 - val_loss: 0.0584