<jupyter_start><jupyter_text>Colab crashed after 23 epochs Total Epochs = 23<jupyter_code>flag = 1
from keras.models import load_model

if flag == 0: 
  # opt = SGD(lr=1e-1, momentum=0.9)
  model = ResNet.build(64, 64, 3, 200, (3, 4, 6, 3), (64, 64, 128, 256, 512), reg=0.0005)
  model.compile(optimizer=Adam(0.1), loss="categorical_crossentropy", metrics=["accuracy"])
else:
  # Load the model
  model = load_model('../checkpoints/resnet.hdf5')
  # model.compile(optimizer=Adam(0.1), loss="categorical_crossentropy", metrics=["accuracy"])
  
#   # Update the learning rate
#   print(f'Old Learning Rate: {K.get_value(model.optimizer.lr)}')
#   K.set_value(model.optimizer.lr, 0.01)
#   print(f'New Learning Rate: {K.get_value(model.optimizer.lr)}')

model.summary()
model.fit_generator(
  train_generator,
  steps_per_epoch=100000 // 64,
  validation_data=val_generator,
  validation_steps=10000 // 64,
  epochs=27,
  max_queue_size=64 * 2,
  callbacks=callbacks, verbose=1
)

model.save(checkpoint_path)<jupyter_output>Epoch 1/27
   2/1562 [..............................] - ETA: 3:55:02 - loss: 2.3989 - acc: 0.4844<jupyter_text>Ran for 27 epochs with Learning Rate Decay Total epochs = 50<jupyter_code>flag = 1
from keras.models import load_model

if flag == 0: 
  # opt = SGD(lr=1e-1, momentum=0.9)
  model = ResNet.build(64, 64, 3, 200, (3, 4, 6, 3), (64, 64, 128, 256, 512), reg=0.0005)
  model.compile(optimizer=Adam(0.1), loss="categorical_crossentropy", metrics=["accuracy"])
else:
  # Load the model
  model = load_model('../checkpoints/resnet.hdf5')
  # model.compile(optimizer=Adam(0.1), loss="categorical_crossentropy", metrics=["accuracy"])
  
  # Update the learning rate
  print(f'Old Learning Rate: {K.get_value(model.optimizer.lr)}')
  K.set_value(model.optimizer.lr, 0.01)
  print(f'New Learning Rate: {K.get_value(model.optimizer.lr)}')

model.fit_generator(
  train_generator,
  steps_per_epoch=100000 // 64,
  validation_data=val_generator,
  validation_steps=10000 // 64,
  epochs=25,
  max_queue_size=64 * 2,
  callbacks=callbacks, verbose=1
)

model.save(checkpoint_path)<jupyter_output>Old Learning Rate: 0.003375000087544322
New Learning Rate: 0.009999999776482582
Epoch 1/25
1562/1562 [==============================] - 565s 362ms/step - loss: 2.7082 - acc: 0.4228 - val_loss: 3.1932 - val_acc: 0.3475
Epoch 2/25
1562/1562 [==============================] - 550s 352ms/step - loss: 2.4981 - acc: 0.4599 - val_loss: 3.4316 - val_acc: 0.3093
Epoch 3/25
1562/1562 [==============================] - 548s 351ms/step - loss: 2.8139 - acc: 0.4042 - val_loss: 3.0928 - val_acc: 0.3717

Epoch 00003: saving model to ../checkpoints/check.ckpt
Epoch 4/25
1562/1562 [==============================] - 517s 331ms/step - loss: 2.5210 - acc: 0.4589 - val_loss: 3.0829 - val_acc: 0.3679
Epoch 5/25
1562/1562 [==============================] - 554s 355ms/step - loss: 2.6528 - acc: 0.4316 - val_loss: 3.7456 - val_acc: 0.2703
Epoch 6/25
1562/1562 [==============================] - 553s 354ms/step - loss: 2.7304 - acc: 0.4224 - val_loss: 3.2098 - val_acc: 0.3490
Epoch 7/25
1562/1562 [==============[...]<jupyter_text>Ran for another 25 epochs with fluctuating accuracies.  This is a sign of slight overfitting and thus had to regularize the model more and decrease the learning rate Total epochs = 75<jupyter_code>flag = 1
from keras.models import load_model

if flag == 0: 
  # opt = SGD(lr=0.005, momentum=0.9)
  model = ResNet.build(64, 64, 3, 200, (3, 4, 6, 3), (64, 64, 128, 256, 512), reg=0.0005)
  model.compile(optimizer=Adam(0.1), loss="categorical_crossentropy", metrics=["accuracy"])
else:
  # Load the model
  model = load_model(checkpoint_path)
  # model.compile(optimizer=Adam(0.1), loss="categorical_crossentropy", metrics=["accuracy"])
  
  # Update the learning rate
  print(f'Old Learning Rate: {K.get_value(model.optimizer.lr)}')
  K.set_value(model.optimizer.lr, 0.005)
  print(f'New Learning Rate: {K.get_value(model.optimizer.lr)}')

model.fit_generator(
  train_generator,
  steps_per_epoch=100000 // 64,
  validation_data=val_generator,
  validation_steps=10000 // 64,
  epochs=25,
  max_queue_size=64 * 2,
  callbacks=callbacks, verbose=1
)

model.save(checkpoint_path)

flag = 1
from keras.models import load_model

if flag == 0: 
  # opt = SGD(lr=0.005, momentum=0.9)
  model = ResNet.build(64, 64, 3, 200, (3, 4, 6, 3), (64, 64, 128, 256, 512), reg=0.0005)
  model.compile(optimizer=Adam(0.1), loss="categorical_crossentropy", metrics=["accuracy"])
else:
  # Load the model
  model = load_model(checkpoint_path)
  # model.compile(optimizer=Adam(0.1), loss="categorical_crossentropy", metrics=["accuracy"])
  
  # Update the learning rate
  print(f'Old Learning Rate: {K.get_value(model.optimizer.lr)}')
  K.set_value(model.optimizer.lr, 0.005)
  print(f'New Learning Rate: {K.get_value(model.optimizer.lr)}')

model.fit_generator(
  train_generator,
  steps_per_epoch=100000 // 64,
  validation_data=val_generator,
  validation_steps=10000 // 64,
  epochs=25,
  max_queue_size=64 * 2,
  callbacks=callbacks, verbose=1
)

model.save(checkpoint_path)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18492481937121655, 'fraction_numerical': 0.11228275727396993, 'mean_word_length': 4.5978142076502735, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '506620', 'license': 'Apache-2.0', 'n_tokens_mistral': 2361, 'n_tokens_neox': 1937, 'n_words': 413, 'path': 'Assignment 4/Resnet_ImageNet.ipynb', 'repo_name': 'Vishal-V/EIP-3.0', 'size': '5121'}