I think this should work, and it looks like the right approach to me. Make sure to test the two dls are indeed shuffled the same way.
Awesome! Thanks Sylvain! And re: are they the same:
dl2.dls[0].get_idxs() == dl2.dls[1].get_idxs()
is True
For more, see my notebook here:
https://www.kaggle.com/muellerzr/fastai2-tabular-vision-starter-kernel
How to combine models? Any tiny example would be nice .
Working on an example, but depending on how it does Iâll either release it now or later
It will be great Last week I was searching for such example for v2⊠(not for the completion tho)
Best example from a model persepctive is the Kaggle comp where it mixed Tab + Vision + Text (it was a pet adoption one). The DLâs should be somewhat the same from what I had above so that should help with merging models
Is the DataLoaders class supposed to load in all the data from a subclass of IterableDataset into memory? Or am I missing some setting to disable the _listify call? Tried it with:
DataLoaders.from_dsets(train_ds=train_dl, valid_ds=valid_dl)
Just checking if there are any thoughts on this since itâd really help me at the moment due to my data depending on earlier timesteps. Precomputing the whole dataset into independent datapoints is infeasible.
I might be missing something, but to me train_dl and valid_dl suggest to me that they are Dataloaders. IF so you should be able to create the Dataloaders object using the regular __init__
function.
Actually which version of fastai re you using?
Tried v1 first, but read that it didnât support IterableDataset. So Iâm on v2 now.
And yeah, sorry, those names are from when I messed around trying to get it to work. They are torch IterableDataset subclasses, not dataloaders. I tried wrapping them in DataLoader classes like you said, but it seems to try and use the __getitem__ method of Dataset instead of __iter__. Anyway, I didnât mean to hijack this thread. Iâll look around some more, maybe post it in the help channel.
Ah okay, yeah I wasnât able to find where from_dsets
, takes keyword arguments for the datasets. So I was wondering if you were on a different version: https://github.com/fastai/fastai2/blob/master/fastai2/data/core.py#L124
Iâm currently trying to use a torchvision.transforms
that works in my plain pytorch dataloader but when I use it as item_tfms
in a fastai ImageDataLoaders I get the error:
âCould not do one pass in your dataloader, there is something wrong in itâ
I guess, there is a straightforward way to do it, but so far I didnât found a hint in the docs or the forum threads. Maybe somebody knows how to get that working?
Can you grab a batch and show what the error says @MicPie? Or if youâre using the DataBlock
can you show the result of dblock.summary()
?
Thank you for your help.
I could track down the error:
The image transform was also applied to y-data which was of type TensorCategory
and this broke it.
I could fix it with the following setup:
@patch
def augfunc(x:Image.Image):
<aug func code here>
class AugFunc(Transform):
def encodes(self, x:(Image.Image,*TensorTypes)): return x.augfunc()
But I am not sure if this is the most elegant way?
Looks to be the right way if theyâre of type PILImage and not quite TensorImages when they get there
I wanted to implement support for bounding boxes in WandbCallback
but there does not seem to be a ânormalized wayâ to handle them:
- I could not find an example where a model is trained on them
- there is a
DataBlock
example in50_tutorial.datablock.ipynb
(not for training though) where the output is split in 2 blocks: one is a list of bounding boxes and the other one is the corresponding list of classes
I think ideally TensorBBox
would also contain the class so we can easily identify we are working on a bounding box detection problem through typedispatch
.
It could be anything else but I canât find a ânormalized wayâ of treating these problems like we get with semantic segmentation (where we can reliably access optional labels with get_meta('codes')
).
here is one example.
I do like the idea of this, as I canât think of a reason a bounding box doesnât have a label to go along with it, at least for general use, but I also donât know their insight into splitting it up
In kaggle how to do prediction on test set using fastai2.
If someone could help, i would be great. Im not understanding test_dl and getpreds in fastai2
So letâs say I have a list of file names for my test set. Here would be my steps
- get my file names
- Run
dl=learn.dls.test_dl(fnames)
preds=learn.get_preds(dl=dl)
thanks, this worked,
I have one more question
i am working on multi label classification
got preds by the method you told but have problem here
code:
thresh=0.2
labelled_preds = [' '.join([learn.dls.vocab[i] for i,p in enumerate(pred) if p > thresh]) for pred in preds]
I am getting
RuntimeError: bool value of Tensor with more than one value is ambiguous
please HELP
How to check what transforms are applied?
I want to keep only vertical and horizontal flips, so I set these values:
batch_tfms=aug_transforms(flip_vert=True, max_rotate=0, min_zoom=1, max_zoom=1, max_lighting=0, max_warp=0),
The datablock.summary
gives something but Iâm still not sure if thereâs something else happening
Pipeline: IntToFloatTensor -> AffineCoordTfm