In meta-learning we are suppose to train task ($\mathcal{T}_{i}$) with meta-train dataset ($\mathcal{D}_i^{\text{tr}}$). Say, we are training a 5-way ($N:5$) 2-shots $K:2$ meta-learning model with batch-size equals to 16, how do we build the data pipeline? Here's my process below.
I'm using Omniglot - a handwritten dataset contains 1623 different handwritten characters from 50 different alphabets. Each character of these 50 alphabets has 20 images.
Here is the data pipeline I implemented:
for batch $b, b=1,...,16$:
1. Random sample 5 (N) classes among 1623 total characters and sample 3 (K + 1) images for each class (image input tensor shape: [3, 5, 28, 28])
2. Transform ground truth labels to one hot vectors (label input tensor shape: [3, 5, 5])
3. Append image tensor and label tensor
4. Repeat till it reaches the 16th batch
I'm not sure about the first step. Do I always random sample different classes for each batch? Or do I sample classes before loop starts and always use the same classes for every batch, but only resample images within those classes? If the former is corret. Could the model learn anything? Wouldn't the model has to learn a new mapping every batch, since classes are different everytime we run backpropagation through a batch?