Unet_learner

wondering if someone can help me, I am training with this datablock

dblock = DataBlock(blocks=(ImageBlock, MaskBlock()),
               get_items=get_image_files,
               get_y=lambda o:str(o).replace('images','masks'),
               splitter=RandomSplitter(valid_pct=0.2,seed=2020),
               item_tfms=Resize(352), # transformPipeline]
               batch_tfms=[Normalize.from_stats(*imagenet_stats)])

ds = dblock.datasets(source=path/'images')
dls = dblock.dataloaders(image_path, bs=bs, workers = 8)

Then I create the learner, and traing…

learner = unet_learner(dls,
                     resnet34,
                     opt_func = optimizer,
                     loss_func=symmetric_lovasz,
                     metrics=[Dice_soft(), Dice_th()],
                     config = config,
                     n_out=1 )

But then I get this.

Can someone give me a hint of what I am doing wrong ? thanks.

Hi Oscar,

Two possible suggestions:

Could it be you picked an overly aggressive learning rate? (I’m a beginner so this suggestion could be way off)

To find the learning rate automatically…

lrn_rate = learner.lr_find()
print(lrn_rate.valley) # plug this value into your learner

Second suggestion: perhaps your callback method for unfreezing is where the problem is (can’t see where it is defined). Would it be better to use fastai fine_tune to rule that out?

Paul

Hi Oscar,

I was so focused on your question, I didn’t look at the year you asked it, cerca 2020, until now. My guess is that you figured it out.

Great question though, it helped me formalize some of the learning I’ve been doing!

Best regards,

Paul