MultiFloatList - reimplementation of DeViSe in fastai v1


I was trying to get through devise in fastai 0.7 on google colab and got stack am problems on running out of memory while trying to get the first batch of images from DataSet.

Therefore, I decided to try to get it running in fastai v1, and got stuck on creation of databunch.

As input, I have a list of image names and a list of encoding (numpy vectors of size 300) for image classes for each image in the first list.

When I try to use the ImageDataBunch.from_lists,

tmd = ImageDataBunch.from_lists(PATH, images_full_path, img_vecs, 0.1)

I got for y type y: MultiCategoryList

I have searched a forum for similar topics, and found as well this post,,

but was not able to find how to do similar things with a vector of floats (regression on multiple outputs) instead of MultiCategoryList.

As well, I was not able to find something like MultiFloatList in fastai code.

Could you please advise, how to best proceed with this scenario in fastai v1?

1 Like

You will need to use the data block API in this case, and the label_cls you need is FloatList.

1 Like

Thanks a lot.

It seems to function at this stage.

The code that I have used for creating imagedatabunch from lists of imagepathes and imagevectors is the following:

fname2label = {f:l for (f,l) in zip(images_full_path, img_vecs)} 
data = (ImageList(images_full_path, path=PATH)
       .label_from_func(lambda x:fname2label[x], label_cls=FloatList)
        .transform(get_transforms(), size=64).databunch()