Skip to content

Problem with number of classes #1750

Closed Answered by adamjstewart
lcoandrade asked this question in Q&A
Discussion options

You must be logged in to vote

If you use a dataset transform, it will take in a dict and return a dict, so you decide which dict keys are affected. Something as simple as:

class ReclassTransformer:
    def __call__(self, sample):
        x = sample["mask"]
        x[x == 255] = 1
        sample["mask"] = x
        return sample

gt_set = MyRasterMask(paths, transforms=ReclassTransformer())

should work, but I haven't tested it.

If you use a data module augmentation, those are designed to use Kornia augmentations, so the syntax will be pretty different.

Replies: 4 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@adamjstewart
Comment options

Comment options

You must be logged in to vote
1 reply
@adamjstewart
Comment options

Answer selected by lcoandrade
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
trainers PyTorch Lightning trainers
2 participants