question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add keepdim to RandomChannelShuffle

See original GitHub issue

Describe the bug

K.augmentation.RandomChannelShuffle inconsistency with others kornia augmentations. Keepdim is not in argument of the RandomChannelShuffle class, and so always broadcast it to the batch form (eg, broadcast a torch.Size([6, 64, 64]), CHW to torch.Size([1, 6, 64, 64]) BCH*W)

Reproduction steps

>>> import torch
>>> import kornia as K
>>> image = torch.rand((6,64,64))
>>> image.shape
torch.Size([6, 64, 64])
>>> transform = K.augmentation.RandomChannelShuffle(p=0.8)
>>> transform(image).shape
torch.Size([1, 6, 64, 64])

Expected behavior

>>> import torch
>>> import kornia as K
>>> image = torch.rand((6,64,64))
>>> image.shape
torch.Size([6, 64, 64])
>>> transform = K.augmentation.RandomChannelShuffle(p=0.8, keepdim=True)
>>> transform(image).shape
torch.Size([6, 64, 64])

Environment

  • PyTorch Version (e.g., 1.0): 1.10.0
  • OS (e.g., Linux): Ubuntu 20.04.3 LTS (x86_64)
  • How you installed PyTorch (conda, pip, source): conda
  • Python version: 3.9.7
  • CUDA/cuDNN version: 11.4.152
  • GPU models and configuration: GPU 0: NVIDIA TITAN X (Pascal)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
julien-blanchoncommented, Dec 8, 2021

@julien-blanchon could you send a PR with the patch ? Not sure why some are missing @shijianjian ?

Yes, waiting for review https://github.com/kornia/kornia/pull/1486

0reactions
edgarribacommented, Dec 8, 2021

@julien-blanchon could you send a PR with the patch ? Not sure why some are missing @shijianjian ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Transforms — MONAI 1.1.0 Documentation
Randomly select regions in the image, then shuffle the pixels within every region. It shuffles every channel separately. Refer to paper: Kang, Guoliang, ......
Read more >
Image Augmentations - Kornia - Read the Docs
Add random blur with a box filter to an image tensor. _images/RandomBoxBlur.png. Parameters ... Shuffle the channels of a batch of multi-dimensional images....
Read more >
How to randomly shuffle data and target in python?
I have a 4D array training images, whose dimensions correspond to (image_number,channels,width,height).
Read more >
The Annotated Diffusion Model - Hugging Face
In this blog post, we'll take a deeper look into Denoising Diffusion Probabilistic Models (also known as DDPMs, diffusion models, ...
Read more >
Pytorch Tutorial from Basic to Advance Level - Kunal Bhashkar
In this blog, I will explain about Pytorch open-source Deep Learning library with the algorithmic implementation of Deep learning concepts.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found