@muellerzr I have a fastai2 question not necessarily related to you notebooks, but since I am following along with your online lectures, I thought I would post here and ask you. I hope this is fine, and if not I will post as a separate topic under #fastai-users.
Just to play around with fastai2, I thought I would try to train a model for Bengali.AI Kaggle competition. However, I am struggling with creating the DataBlock.
In particular, the competition has 3 separate targets for a single image. So basically, the loss function needs to get three predicted target and three actual targets. I tried a few things. Hereās what I had so far:
data = DataBlock(blocks=(ImageBlock,CategoryBlock),
get_x=ColReader(['image_id'],pref=TRAIN,suff='.png'),
splitter=IndexSplitter(list(range(fold*len(df)//nfolds,(fold+1)*len(df)//nfolds))),
get_y=ColReader(['grapheme_root','vowel_diacritic','consonant_diacritic']),
batch_tfms=aug_transforms(do_flip=False,max_warp=0.1,size=sz)
)
Based on playing around with data.summary(df)
(as you had described a little bit in your lecture 3 IIRC), I realize that get_x
, splitter
, and batch_tfms
are most likely correct. However, I think I may not be using the appropriate block
and get_y
. I tried passing in 3 CategoryBlock
s or three ColReader
s or both, but none of these work. I have also tried MultiCategoryBlock, but it always tries to do OneHotEncode
.
In fastai v1, I think if you just passed all the target columns to the col
argument, it would work, but here it doesnāt seem to work that way.
Is there an easy way to do it with the DataBlock
API? Otherwise, do I have to create some form of a Pipeline
?