-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
ImageFolder with Grayscale images dataset #4112
Comments
Hi! Replacing: transformed_dataset = dataset.with_transform(transforms)
transformed_dataset.set_format(type="torch", device="cuda") with: def transform_func(examples):
examples["image"] = [transforms(img).to("cuda") for img in examples["image"]]
return examples
transformed_dataset = dataset.with_transform(transform_func) should fix the issue. |
Ok thanks a lot for the code snippet! I love the way I don't know how to speed up the process without switching to |
You can pass |
Hi, I'm facing a problem with a grayscale images dataset I have uploaded here (RVL-CDIP)
I'm getting an error while I want to use images for training a model with PyTorch DataLoader. Here is the full traceback:
I don't really understand why the image is still a bytes object while I used transformations on it. Here the code I used to upload the dataset (and it worked well):
Now here is the code I am using to get the dataset and prepare it for training:
But this get me the error above. I don't understand why it's doing this kind of weird thing?
Do I need to map something on the dataset? Something like this:
The text was updated successfully, but these errors were encountered: