{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Image Cleaner Widget" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "fastai offers several widgets to support the workflow of a deep learning practitioner. The purpose of the widgets are to help you organize, clean, and prepare your data for your model. Widgets are separated by data type." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "hide_input": true }, "outputs": [], "source": [ "from fastai.vision import *\n", "from fastai.widgets import *\n", "from fastai.gen_doc.nbdoc import *" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "hide_input": true }, "outputs": [], "source": [ "%reload_ext autoreload\n", "%autoreload 2" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "path = untar_data(URLs.MNIST_SAMPLE)\n", "data = ImageDataBunch.from_folder(path)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "learn = cnn_learner(data, models.resnet18, metrics=error_rate)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
epoch | \n", "train_loss | \n", "valid_loss | \n", "error_rate | \n", "time | \n", "
---|---|---|---|---|
0 | \n", "0.233059 | \n", "0.115309 | \n", "0.033857 | \n", "00:10 | \n", "
1 | \n", "0.110543 | \n", "0.085249 | \n", "0.028459 | \n", "00:10 | \n", "
class
DatasetFormatter
[source][test]DatasetFormatter
()\n",
"\n",
"from_similars
[source][test]from_similars
(**`learn`**, **`layer_ls`**:`list`=***`[0, 7, 2]`***, **\\*\\*`kwargs`**)\n",
"\n",
"from_toplosses
[source][test]from_toplosses
(**`learn`**, **`n_imgs`**=***`None`***, **\\*\\*`kwargs`**)\n",
"\n",
"No tests found for from_toplosses
. To contribute a test please refer to this guide and this discussion.
from_most_unsure
[source][test]from_most_unsure
(**`learn`**:[`Learner`](/basic_train.html#Learner), **`num`**=***`50`***) → `Tuple`\\[[`DataLoader`](https://pytorch.org/docs/stable/data.html#torch.utils.data.DataLoader), `List`\\[`int`\\], `Sequence`\\[`str`\\], `List`\\[`str`\\]\\]\n",
"\n",
"No tests found for from_most_unsure
. To contribute a test please refer to this guide and this discussion.
class
ImageCleaner
[source][test]ImageCleaner
(**`dataset`**:[`LabelLists`](/data_block.html#LabelLists), **`fns_idxs`**:`Collection`\\[`int`\\], **`path`**:`PathOrStr`, **`batch_size`**=***`5`***, **`duplicates`**=***`False`***) :: [`BasicImageWidget`](/widgets.image_cleaner.html#BasicImageWidget)\n",
"\n",
"Tests found for ImageCleaner
:
pytest -sv tests/test_widgets_image_cleaner.py::test_image_cleaner_index_length_mismatch
[source]pytest -sv tests/test_widgets_image_cleaner.py::test_image_cleaner_length_correct
[source]pytest -sv tests/test_widgets_image_cleaner.py::test_image_cleaner_with_data_from_csv
[source]pytest -sv tests/test_widgets_image_cleaner.py::test_image_cleaner_wrong_input_type
[source]To run tests please refer to this guide.
(n_batches, n_features, 1, 1)
then you don't need any pooling (this is the case with the last layer). The suggested use of `.from_similars()` with resnets is using the last layer and no pooling, like in the following cell."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Getting activations...\n"
]
},
{
"data": {
"text/html": [
"\n",
" class
PredictionsCorrector
[source][test]PredictionsCorrector
(**`dataset`**:[`LabelLists`](/data_block.html#LabelLists), **`fns_idxs`**:`Collection`\\[`int`\\], **`classes`**:`Sequence`\\[`str`\\], **`labels`**:`Sequence`\\[`str`\\], **`batch_size`**:`int`=***`5`***) :: [`BasicImageWidget`](/widgets.image_cleaner.html#BasicImageWidget)\n",
"\n",
"No tests found for PredictionsCorrector
. To contribute a test please refer to this guide and this discussion.
epoch | \n", "train_loss | \n", "valid_loss | \n", "accuracy | \n", "time | \n", "
---|---|---|---|---|
0 | \n", "0.245369 | \n", "0.138495 | \n", "0.953610 | \n", "02:14 | \n", "
1 | \n", "0.133183 | \n", "0.103801 | \n", "0.963695 | \n", "02:16 | \n", "
show_corrections
[source][test]show_corrections
(**`ncols`**:`int`, **\\*\\*`fig_kw`**)\n",
"\n",
"No tests found for show_corrections
. To contribute a test please refer to this guide and this discussion.