Skip to content

Commit

Permalink
Add model training
Browse files Browse the repository at this point in the history
  • Loading branch information
AnanthVivekanand committed Oct 21, 2020
1 parent 13bd8f2 commit c17305a
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions main.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,28 @@
"\n",
"print(\"Pre-training accuracy: %.4f%%\" % accuracy) "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from keras.callbacks import ModelCheckpoint\n",
"from datetime import datetime \n",
"\n",
"num_epochs = 72\n",
"num_batch_size = 256\n",
"\n",
"checkpointer = ModelCheckpoint(filepath='saved_models/weights.best.basic_cnn.hdf5', \n",
" verbose=1, save_best_only=True)\n",
"start = datetime.now()\n",
"model.fit(x_train, y_train, batch_size=num_batch_size, epochs=num_epochs, validation_data=(x_test, y_test), callbacks=[checkpointer], verbose=1)\n",
"\n",
"\n",
"duration = datetime.now() - start\n",
"print(\"Training completed in time: \", duration)"
]
}
],
"metadata": {
Expand Down

0 comments on commit c17305a

Please sign in to comment.