Using TIFF images with fastai

Dear fellow users:
I am trying to denoise 2d MR images. The paper I am trying to start off from is based on “Beyond a Gaussian Denoiser”. So, I have a train folder (im + noise) and a target/ground truth folder ( im ). The network in itself is simple in that it has a bunch of conv, BN, Relu operation without any pooling. So, the size of output from the network is the same as that of the input. They then find the MSE loses with ground truth and train the model.

How do I generate the Image Databunch. I was hoping to use something along the lines of

    data = (src.label_from_func(lambda x: path_hr/x.relative_to(path_lr))
               .transform(get_transforms(max_zoom=2.), size=size, tfm_y=True)
               .databunch(bs=bs).normalize(imagenet_stats, do_y=True))

        data.c = 3
        return data

data.c looks like the number of classes and I am not working on a classification problem. So, I would appreciate if you could give me some information as to how to proceed with it.

Best regards,
Vishwa

You should check out Lesson-7 (https://course.fast.ai/videos/?lesson=7), you will see a similar example to yours.Have a look at https://nbviewer.jupyter.org/github/fastai/course-v3/blob/master/nbs/dl1/lesson7-superres-gan.ipynb notebook.

Cheers

data.c is not exactly the number of classes. It’s the output vector size of the last layer. Also if you comment out this line here it won’t change anything. Don’t know why is it used here.

Follow up: data.c is the number of channels for output vector size. Since we are outputting an RGB image that’s why it is marked as 3. Although it’s of no use here since UNet is already designed accordingly.