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

RandomGrayscale: add new transform #1301

Merged
merged 1 commit into from
May 3, 2023
Merged

Conversation

adamjstewart
Copy link
Collaborator

@adamjstewart adamjstewart commented May 2, 2023

Each of these images are scaled from 0–1 for plotting, so the brightness of the image may not be comparable.

avg
rgb
pca

@adamjstewart adamjstewart added this to the 0.5.0 milestone May 2, 2023
@adamjstewart adamjstewart added this to In progress in SSL4EO-L via automation May 2, 2023
@github-actions github-actions bot added testing Continuous integration testing transforms Data augmentation transforms labels May 2, 2023
@calebrob6
Copy link
Member

calebrob6 commented May 3, 2023

This seems tricky to use if you aren't steeped in geospatial and torch stuff. Can we provide reasonable defaults to weights somehow?

Maybe like some factory constructors? .from_example_sample(ds[0], weighting='uniform') returns an instance where the weights are set to 1/num_channels?

@adamjstewart
Copy link
Collaborator Author

It's certainly harder to use than Kornia's RandomGrayscale, but I wouldn't describe it as harder to use than Kornia's Normalize.

It's possible to set a default for average/uniform weighting, but it isn't possible to set any other defaults without the user explicitly saying which bands are RGB or what the first principal component is. If we set the default to average/uniform weighting, we'll need to support scalar inputs (we won't know the # of channels until run-time) and move the rescaling to forward.

@calebrob6
Copy link
Member

That's why I said .from_example_sample(ds[0], weighting='uniform') where you pass an example that has the number of channels

@adamjstewart
Copy link
Collaborator Author

But that won't work for RGB or PCA unless you want to give it a list of indices or the entire dataset. Idk, feels like a lot more code and would necessitate bringing sklearn back as a dep.

@adamjstewart adamjstewart merged commit f8f05cf into main May 3, 2023
17 checks passed
SSL4EO-L automation moved this from In progress to Done May 3, 2023
@adamjstewart adamjstewart deleted the transforms/grayscale branch May 3, 2023 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing Continuous integration testing transforms Data augmentation transforms
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants