Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: tutorial on dataset presizing #127

Merged
merged 42 commits into from
Jun 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
3b41b97
Make `FileDataset` return `Path`s again
lorenzoh Apr 29, 2021
bf3dca7
adjust default projective augmentation params
lorenzoh Apr 29, 2021
1e3006f
update test
lorenzoh Apr 29, 2021
479a510
add paramgroups notebook
lorenzoh Apr 30, 2021
0d5d316
fix augment vision docs
lorenzoh May 4, 2021
94287af
rerun notebook
lorenzoh May 4, 2021
d166305
update image segmentation notebook
lorenzoh May 4, 2021
3be4833
remove unused doc file
lorenzoh May 4, 2021
2341094
add discriminative learning rates to `finetune!`
lorenzoh May 4, 2021
29b26e2
update DataAugmentation dep
lorenzoh May 4, 2021
c4c9076
import for paramgroups
lorenzoh May 4, 2021
401b35e
add `AdaptiveConcatPool` layer
lorenzoh May 4, 2021
6ccd3ec
update augmentation args for `ImageSegmentation`
lorenzoh May 4, 2021
4a051bc
allow explicitly passing `validdata` to `methodlearner`
lorenzoh May 4, 2021
f95d91c
add `visionhead` similar to fastai's
lorenzoh May 4, 2021
d2dbced
add dataset size biwi_head_pose
lorenzoh May 10, 2021
604290f
add docs to `ProjectiveTransforms`, `ImagePreprocessing`
lorenzoh May 10, 2021
d88a76b
implement dynamic U-Net
lorenzoh May 10, 2021
a5235a5
implement keypoint regression
lorenzoh May 10, 2021
894b22d
improve docs
lorenzoh May 10, 2021
3de0d47
Merge branch 'master' into develop
lorenzoh May 10, 2021
7765baf
remove deprecated `dense.W` field access
lorenzoh May 10, 2021
c892538
added `plotprediction!` and test suite for plot interface
lorenzoh May 10, 2021
663dc2a
improved learning methods' docstrings
lorenzoh May 10, 2021
7707db9
add singlekeypointregression tests
lorenzoh May 10, 2021
820819f
fix testsets for plot
lorenzoh May 11, 2021
7abe340
add serialization
lorenzoh May 11, 2021
c41b975
improve `show` methods
lorenzoh May 11, 2021
7fd4032
remove redundant `show` methods
lorenzoh May 13, 2021
9af28fe
fix `plotbatch!`
lorenzoh May 13, 2021
e52f1d1
rerun serialization notebook
lorenzoh May 13, 2021
bd6e928
add visualization how to
lorenzoh May 13, 2021
7fd1074
fix shuffling bug in methoddataloaders
lorenzoh May 13, 2021
d4f2a50
add `plotpredictions`
lorenzoh May 13, 2021
7d969af
rerun fitonecycle notebook
lorenzoh May 13, 2021
2988c65
rerun imagesegmentation notebook
lorenzoh May 13, 2021
1baba37
rerun keypoint notebook
lorenzoh May 13, 2021
7a3f13b
Merge branch 'master' into develop
lorenzoh Jun 15, 2021
d705c9f
Add Metalhead PR setup instructions
lorenzoh Jun 15, 2021
d85ab07
Add how-to for TensorBoard logging
lorenzoh Jun 15, 2021
50f4934
Add presizing tutorial
lorenzoh Jun 15, 2021
a50f88b
Add imagenette2 hash
lorenzoh Jun 15, 2021
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
Binary file added assets/tensorboardscreenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
60 changes: 60 additions & 0 deletions docs/howto/logtensorboard.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# How to log to TensorBoard

TensorBoard is a format and viewer for logs of model training and can be used to inspect and compare the results of training runs. We can log step and epoch metrics, hyperparameters and even visualizations to TensorBoard using FluxTraining.jl's logging callbacks.

## Generating logs

To use logging callbacks, we need to pass a log backend, here [`TensorBoardBackend`](#). This design allows flexibly supporting other logging backends like Weights and Biases or neptune.ai in the future.

{cell=main}
```julia
using FastAI

dir = mktempdir()
backend = TensorBoardBackend(dir)
```

Then we create callbacks for logging metrics and hyperparameters to that backend:

{cell=main}
```julia
metricscb = LogMetrics(backend)
hparamscb = LogHyperParams(backend)
```

Like any other callbacks, these can then be passed to a `Learner` along with other callbacks and we can start training. By using the [`Metrics`](#) callback we can log metrics other than the loss.

```julia

callbacks = [
metricscb,
hparamscb,
ToGPU(),
Metrics(accuracy)
]

data = Datasets.loadtaskdata(Datasets.datasetpath("imagenette2-160"), ImageClassificationTask)
method = ImageClassification(Datasets.getclassesclassification("imagenette2-160"), (160, 160))
learner = methodlearner(method, data, Models.xresnet18(), callbacks...)
fitonecycle!(learner, 5)
```

## Inspecting logs

To inspect the logs you will have to install the `tensorboard` command-line using `pip` (you can access the command-line in the Julia REPL by pressing `;`).

```
shell> pip install tensorboard
```

After this one-time installation, you can run it by pointing it to the log directory created above:

```
shell> tensorboard --logdir $dir
```

This should give you an URL that you can open in a browser which should look like this:

![](../../assets/tensorboardscreenshot.png)

Note that you can also open TensorBoard and it will update as the training progresses.
8 changes: 7 additions & 1 deletion docs/setup.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Setup

FastAI.jl is not registered yet, but you can try it out by installing it manually. You should be able to install FastAI.jl using the REPL as follows:
FastAI.jl is not registered yet, but you can try it out by installing it manually. You should be able to install FastAI.jl using the REPL as follows (The package mode in the REPL can be entered by typing `]`).

```julia
pkg> add https://github.com/FluxML/FastAI.jl
Expand All @@ -10,4 +10,10 @@ FastAI.jl also defines [Makie.jl](https://github.com/JuliaPlots/Makie.jl) plotti

```julia
pkg> add CairoMakie
```

To use pretrained vision models, you currently have to install a WIP branch of Metalhead.jl:

```julia
pkg> add https://github.com/darsnack/Metalhead.jl#darsnack/vision-refactor
```
413 changes: 413 additions & 0 deletions docs/tutorials/presizing.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/datasets/fastaidatasets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const DATASETCONFIGS = [
FastAIDataset("imagenette", "imageclas"),
FastAIDataset("imagenette2-160", "imageclas", "64d0c4859f35a461889e0147755a999a48b49bf38a7e0f9bd27003f10db02fe5"),
FastAIDataset("imagenette2-320", "imageclas", "569b4497c98db6dd29f335d1f109cf315fe127053cedf69010d047f0188e158c"),
FastAIDataset("imagenette2", "imageclas"),
FastAIDataset("imagenette2", "imageclas", "6cbfac238434d89fe99e651496f0812ebc7a10fa62bd42d6874042bf01de4efd"),
FastAIDataset("imagewang-160", "imageclas", "a0d360f9d8159055b3bf2b8926a51d19b2f1ff98a1eef6034e4b891c59ca3f1a", size="182MiB"),
FastAIDataset("imagewang-320", "imageclas", "fd53301c335aa46f0f4add68dd471cd0b8b66412382cc36f5f510d0a03fb4d9d", size="639MiB"),
FastAIDataset("imagewang", "imageclas"),
Expand Down
2 changes: 2 additions & 0 deletions toc.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- [Data containers](docs/data_containers.md)
- [Learning methods](docs/learning_methods.md)
- [Saving and loading models](docs/notebooks/serialization.ipynb)
- [Presizing vision datasets](docs/tutorials/presizing.ipynb)
- Learning tasks
- [Image classification](docs/methods/imageclassification.md)
- [Image segmentation](docs/notebooks/imagesegmentation.ipynb)
Expand All @@ -16,6 +17,7 @@
- [Find a good learning rate](docs/notebooks/lrfind.ipynb)
- [Augment vision data](docs/howto/augmentvision.md)
- [Visualize data](docs/notebooks/how_to_visualize.ipynb)
- [Log to TensorBoard](docs/howto/logtensorboard.md)
- Reference
- [Docstrings](REFERENCE)
- [Interfaces](docs/interfaces.md)
Expand Down