Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gridmask can't be added to the compse step? #16

Open
M-Ghorbel opened this issue Nov 22, 2020 · 3 comments
Open

Gridmask can't be added to the compse step? #16

M-Ghorbel opened this issue Nov 22, 2020 · 3 comments

Comments

@M-Ghorbel
Copy link

M-Ghorbel commented Nov 22, 2020

Hello

I want to remplace Randomerasing by Gridmask in the compse step

def get_transform(resize, phase='train'): if phase == 'train': return transforms.Compose([ transforms.Resize(size=(int(resize[0] / 0.875), int(resize[1] / 0.875))), transforms.RandomHorizontalFlip(0.5), transforms.ColorJitter(brightness=0.126, saturation=0.5), transforms.ToTensor(), transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]), GridMask(200, 300, rotate = 1, ratio = 0.8, mode=1, prob=1) ])

but i'm getting this error

n,c,h,w = x.size()
ValueError: not enough values to unpack (expected 4, got 3)

i think that it need a batch, so is it possible to use it in compose ?

@akuxcw
Copy link
Collaborator

akuxcw commented Nov 23, 2020

Of course, you can use it in compose, just use Grid instead of GridMask in grid.py

@M-Ghorbel
Copy link
Author

M-Ghorbel commented Nov 24, 2020

i remplaced GridMask by Grid but i'm getting this error

"...grid.py", line 70, in__call__

mask = torch.from_numpy(mask).float().cuda()
RuntimeError: CUDA error: initialization error

@curryandsun
Copy link

i remplaced GridMask by Grid but i'm getting this error

"...grid.py", line 70, in__call__

mask = torch.from_numpy(mask).float().cuda()
RuntimeError: CUDA error: initialization error

you can do like this:
mask = torch.from_numpy(np.array(mask))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants