Anki
Colab link: https://colab.research.google.com/github/fastai/fastbook/blob/master/06_multicat.ipynb#scrollTo=f07AU9ac3zP_
Aim: create a (vision) model that can assign multiple (including zero) labels to each item
Setup
Python: CSV to DataFrame
pd.read_csv(path)FastAI: what does Datasets do?
Creates a list of tuples by applying a set of transforms to some input data
FastAI: load a DataFrame into a DataBlock
data_block.<datasets|dataloaders>(data_frame)Training
PyTorch: module for single-class loss on probabilities
nn.NLLLossPyTorch: module for single-class loss on logits
nn.CrossEntropyLossPyTorch: module for multi-class loss on probabilities
nn.BCELossPyTorch: module for multi-class loss on logits
nn.BCEWithLogitsLossPyTorch: module for regression loss
nn.MSELossDifference in final layer between single-class and multi-class neural nets
single-class: softmax
multi-class: individual sigmoids
What is the term for the loss typically used in the multi-class classification setting?
Binary cross-entropy
Python: partial function application
new_fn = partial(fn, arg=value, ...)FastAI: calculate validation metrics without re-training
learner.validate()Pytorch: get n values spread uniformly across a range
torch.linspace(start, end, n)FastAI: visualise batch
dls.show_batch()FastAI: visualise model output on validation data
learn.show_results()