Image regression: learn.predict() gives wrong shape/dtype

Hi!
To recap chapter 6, I am working on a image regression problem, where I try to estimate the cell confluence of an image (more or less that means: how much of the image is covered by cells).
I’ve got a csv file with the image paths and the confluence values (between 0 and 1).

My DataBlock:

def get_x®: return path/r[‘img_path’]
def get_y®: return r[‘value’]

data_block = DataBlock(
blocks=(ImageBlock, RegressionBlock),
get_x=get_x,
get_y=get_y,
splitter=RandomSplitter(),
item_tfms=Resize(230, ResizeMethod.Pad, pad_mode=‘zeros’)
)

dls = data_block.dataloaders(df)

Dataloaders are looking good and training seems to work.

learn = cnn_learner(dls, resnet18, y_range=(0,1))

But when I am trying to predict after the training the value for a new image, the shape and data types do not make sense…

learn.predict(‘test_images/13.01.20_Dex_400µm_1_la_2.jpg’)
Output:
((182, 173, 160), TensorImage([1.]), TensorImage([1.]))

Does anyone of you know where’s my bug?

Thank you :slight_smile: