Skip to content

Commit

Permalink
Add: convert_to_rgb
Browse files Browse the repository at this point in the history
  • Loading branch information
jp1924 committed Nov 12, 2024
1 parent e9503ec commit ae573cf
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/transformers/models/vit/image_processing_vit_fast.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from ...image_processing_base import BatchFeature
from ...image_processing_utils import get_size_dict
from ...image_processing_utils_fast import BaseImageProcessorFast, SizeDict
from ...image_transforms import FusedRescaleNormalize, NumpyToTensor, Rescale
from ...image_transforms import FusedRescaleNormalize, NumpyToTensor, Rescale, convert_to_rgb
from ...image_utils import (
IMAGENET_STANDARD_MEAN,
IMAGENET_STANDARD_STD,
Expand Down Expand Up @@ -279,6 +279,9 @@ def preprocess(
image_type=image_type,
)

if do_convert_rgb:
images = [convert_to_rgb(image) for image in images]

transforms = self.get_transforms(
do_resize=do_resize,
do_rescale=do_rescale,
Expand Down

0 comments on commit ae573cf

Please sign in to comment.