Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 3 additions & 39 deletions examples/notebooks/EfficientNet_Cifar100_finetuning.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1398,7 +1398,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Let's create two evaluators to compute metrics on train/test images and log them to Tensorboard:"
"Let's create an evaluator to compute metrics on train/test images and log them to Tensorboard:"
]
},
{
Expand All @@ -1423,42 +1423,6 @@
" device=device, non_blocking=True)"
]
},
{
"cell_type": "code",
"execution_count": 40,
"metadata": {},
"outputs": [],
"source": [
"from ignite.contrib.handlers import CustomPeriodicEvent\n",
"\n",
"cpe = CustomPeriodicEvent(n_epochs=3)\n",
"cpe.attach(trainer)\n",
"\n",
"\n",
"def run_evaluation(engine):\n",
" train_evaluator.run(eval_train_loader)\n",
" evaluator.run(test_loader)\n",
"\n",
"\n",
"trainer.add_event_handler(cpe.Events.EPOCHS_3_STARTED, run_evaluation)\n",
"trainer.add_event_handler(Events.COMPLETED, run_evaluation)\n",
"\n",
"\n",
"# Log train eval metrics:\n",
"tb_logger.attach(train_evaluator,\n",
" log_handler=OutputHandler(tag=\"training\",\n",
" metric_names=list(metrics.keys()),\n",
" another_engine=trainer),\n",
" event_name=Events.EPOCH_COMPLETED)\n",
"\n",
"# Log val metrics:\n",
"tb_logger.attach(evaluator,\n",
" log_handler=OutputHandler(tag=\"test\",\n",
" metric_names=list(metrics.keys()),\n",
" another_engine=trainer),\n",
" event_name=Events.EPOCH_COMPLETED)"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -1835,9 +1799,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.4"
"version": "3.8.2"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
}