Skip to content

Grayscale Image Source #665

Answered by samet-akcay
rumanto00 asked this question in Q&A
Discussion options

You must be logged in to vote

@rumanto00, I agree with @Jonas1302. You could create your custom transforms and add it to your config.yaml file as @Jonas1302 suggested.

For example, here is a code snippet how you could generate those transform configs via albumentations.

from skimage import data
import albumentations as A
from albumentations.pytorch import ToTensorV2

image = data.camera()

transforms = A.Compose([A.ToRGB(), ToTensorV2()])
transformed_image = transforms(image=image)["image"]

# (512, 512) torch.Size([3, 512, 512])
print(image.shape, transformed_image.shape)

A.save(transforms, "transforms.yaml", data_format="yaml")

This would save the transforms to transforms.yaml file, which would be something like th…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by djdameln
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
None yet
4 participants
Converted from issue

This discussion was converted from issue #650 on November 01, 2022 05:50.