Can FloatList read two number labels from csv?

I’ve been successfully using FloatList and the dataBlock API to run an image -> number regression. I would like to try image -> [n1,n2] regression. Can fastai handle this situation? The issue is getting the data in - I can handle the modelling.

The input csv looks like
id,A,B
f38a6374c348f90b587e046aac6079959adf3835,0,0
c18f2d887b7ae4f6742ee445113fa1aef383ed77,1,0
755db6279dae599ebb4d39a9123cce439965282d,0,1
bc3f0c64fb968ff4a8bd33af6971ecae77c75e08,0,1
068aba587a4950175d04c680d38943fd488d6a9d,0,1
acfe80838488fae3c89bd21ade75be5c34e66be7,0,1

I want a batch to look like…

([batch_size of [image]], [ [0,0], [1,0], [0,1]…(batch_size of them)])

Please show me how to do this with the datablock API, or the most expedient way to accomplish it. I have tried to trace FloatList and one_batch with PyCharm but got lost amongst the iterators.

Thank you!

Sure, just label_from_df by specifying the cols you need to use and label_cls=FloatList to make sure it’s properly labeled.

1 Like

Thanks, it worked exactly right. Onward into new territory…