Apply transformations only to the training set

(Luís) #1

Hello, I’m trying to run Inference on a custom test set. But everytime I do it, I get the following error:

Exception: It's not possible to apply those transforms to your dataset:
 Not implemented: you can't apply transforms to this type of item (EmptyLabel)

I read that this happens because of the transformations I apply in the validation set.

What is the best approach here?

This is how I build my dataset:

tfms = get_transforms(flip_vert=True, max_warp=0, max_zoom=1.2, max_lighting=0.3)
data = (src.transform(tfms, size=size, tfm_y=True)
        .databunch(bs=bs,num_workers=0)
        .normalize(imagenet_stats))

Is there any way to apply the transformations only to the training set? Is this the best option?

I appreciate any help.

Regards,
Luís

0 Likes

(Kushajveer Singh) #2

Create a new databunch for test time. Don’t split it and label empty.

data = (SegmentationItemList.from_folder(path)
                            .split_none()
                            .label_empty()
                            .transform(size=256)
                            .databunch(bs=16)
                            .normalize(imagenet_stats))
0 Likes