Custom data: Code Review/Data Type Error (Solved)

Hi all!

I am trying to create a UNET image to image regression model. my data is 256 channel inputs regressing to a 1 channel output. My data is stored as MATLAB .mat files. I was initially going to convert to numpy arrays and store them but realised that I could read in from the matfiles directly using loadmat from scipy.

My issues:

  1. Am I using the datablock and TransformBlocks correctly?

    dblock = DataBlock(blocks = (TransformBlock, TransformBlock),

                   get_items = glob.glob,
                   get_x     = x_func,
                   get_y     = y_func,
                   splitter  = RandomSplitter(),

    dsets = dblock.dataloaders(path+"*.mat")

This seems to be fine and returns correctly shaped and matched data.

  1. However when I try to run this in a learner I get an error:

    learn=unet_learner(dload,resnet18,n_in=256, n_out=1,loss_func=MSELossFlat)



RuntimeError: expected scalar type Double but found Float

The outputs of the dataloader are floats. Where would this error originate from?

Turns out I just had to get the datatypes right in my get_x and get_y functions… duh