Bounding box classifier as regression problem fastai v1

HI, I am trying to do the bounding box classifier as a regression problem the way Jeremy did in Part 2 of the 2018 course.
I am stuck at the point where we can pass the four coordinates as the output of the network. In Jeremy’s method he used continuous = True in

md = ImageClassifierData.from_csv(PATH, JPEGS, BB_CSV, tfms=tfms, continuous=True, bs=4)

which kept the output BB coordinates as continuous variables. But I am not able to find a similar way in fastai v1. I think it automatically applies one hot encoding on the string containing 4 numbers separated by spaces. I am not able to get how the encoding is happening or how to avoid that.
Can anyone help me know how to avoid the one hot encoding that is being done on those numbers?

You should use the data block API and pass along label_cls=FloatList in your label call to indicate you want continuous targets.

1 Like

I would like to know when we are having four elements as one output, how are we supposed to use this parameter coorectly?
I tried making a list of arrays with four elements each and then make a dataframe of that to use
ImageList.from_df
but when I used the your said method, it raised a value error saying
ValueError: setting an array element with a sequence
Any way to work around that?

It’s not possible for me or anyone to help without seeing any code.

No problem @sgugger. I found the solution. Instead of the way Jeremy did by converting 4 numbers into one string and putting it as one output column in the datafram I used 4 columns each with one of the four bb coordinates. That worked for me, Thanks for your help.