criterion=smp.utils.losses.DiceLoss()
for epoch in range(epochs):
        model.train()
        epoch_loss=0
        for i,(image,mask) in enumerate(train_dl):
                 optimizer.zero_grad()
                 image = image.to(device).float()
                 output=model(image)
                 output=output.to('cpu')
                 output=torch.sigmoid(output)
                 loss=criterion(output,mask)
                 epoch_loss+=loss
                 loss.backward()
                 optimizer.step()
                 scheduler.step()