



import inspect
import unittest

from transformers import DPTConfig
from transformers.file_utils import is_torch_available, is_vision_available
from transformers.models.auto import get_values
from transformers.testing_utils import require_torch, require_vision, slow, torch_device

from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, _config_zero_init, floats_tensor, ids_tensor
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
		import torch
		from torch import nn

		from transformers import MODEL_MAPPING, DPTForDepthEstimation, DPTForSemanticSegmentation, DPTModel
		from transformers.models.dpt.modeling_dpt import DPT_PRETRAINED_MODEL_ARCHIVE_LIST


if is_vision_available():
		from PIL import Image

		from transformers import DPTImageProcessor





class  __magic_name__   :






		def __init__(						self      :     List[str]				,		UpperCamelCase__      :     Tuple				,		UpperCamelCase__      :     List[str]=2				,		UpperCamelCase__      :     Tuple=32				,		UpperCamelCase__      :     Dict=16				,		UpperCamelCase__      :     Optional[int]=3				,		UpperCamelCase__      :     Dict=True				,		UpperCamelCase__      :     Dict=True				,		UpperCamelCase__      :     Tuple=32				,		UpperCamelCase__      :     Dict=4				,		UpperCamelCase__      :     Union[str, Any]=[0, 1, 2, 3]				,		UpperCamelCase__      :     List[str]=4				,		UpperCamelCase__      :     Optional[Any]=37				,		UpperCamelCase__      :     int="gelu"				,		UpperCamelCase__      :     Tuple=0.1				,		UpperCamelCase__      :     Optional[Any]=0.1				,		UpperCamelCase__      :     List[str]=0.02				,		UpperCamelCase__      :     List[str]=3				,		UpperCamelCase__      :     List[Any]=[1, 3_84, 24, 24]				,		UpperCamelCase__      :     Union[str, Any]=True				,		UpperCamelCase__      :     Any=None				,		)				->					Any:
								'''simple docstring'''







								UpperCAmelCase         =     parent
								UpperCAmelCase         =     batch_size
								UpperCAmelCase         =     image_size
								UpperCAmelCase         =     patch_size
								UpperCAmelCase         =     num_channels
								UpperCAmelCase         =     is_training
								UpperCAmelCase         =     use_labels
								UpperCAmelCase         =     hidden_size
								UpperCAmelCase         =     num_hidden_layers
								UpperCAmelCase         =     backbone_out_indices
								UpperCAmelCase         =     num_attention_heads
								UpperCAmelCase         =     intermediate_size
								UpperCAmelCase         =     hidden_act
								UpperCAmelCase         =     hidden_dropout_prob
								UpperCAmelCase         =     attention_probs_dropout_prob
								UpperCAmelCase         =     initializer_range
								UpperCAmelCase         =     num_labels
								UpperCAmelCase         =     backbone_featmap_shape
								UpperCAmelCase         =     scope
								UpperCAmelCase         =     is_hybrid
								# sequence length of DPT = num_patches + 1 (we add 1 for the [CLS] token)
								UpperCAmelCase         =     (image_size // patch_size) ** 2
								UpperCAmelCase         =     num_patches + 1






		def SCREAMING_SNAKE_CASE_			(						self      :     List[Any]      )				->					Optional[int]:
								'''simple docstring'''







								UpperCAmelCase         =     floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size]      )

								UpperCAmelCase         =     None
								if self.use_labels:
														UpperCAmelCase         =     ids_tensor([self.batch_size, self.image_size, self.image_size]				,		self.num_labels      )

								UpperCAmelCase         =     self.get_config()

								return config, pixel_values, labels






		def SCREAMING_SNAKE_CASE_			(						self      :     int      )				->					Dict:
								'''simple docstring'''







								UpperCAmelCase         =     {
								    "global_padding": "same",
								    "layer_type": "bottleneck",
								    "depths": [3, 4, 9],
								    "out_features": ["stage1", "stage2", "stage3"],
								    "embedding_dynamic_padding": True,
								    "hidden_sizes": [96, 1_92, 3_84, 7_68],
								    "num_groups": 2,
								}

								return DPTConfig(
								    image_size=self.image_size				,		patch_size=self.patch_size				,		num_channels=self.num_channels				,		hidden_size=self.hidden_size				,		num_hidden_layers=self.num_hidden_layers				,		backbone_out_indices=self.backbone_out_indices				,		num_attention_heads=self.num_attention_heads				,		intermediate_size=self.intermediate_size				,		hidden_act=self.hidden_act				,		hidden_dropout_prob=self.hidden_dropout_prob				,		attention_probs_dropout_prob=self.attention_probs_dropout_prob				,		is_decoder=UpperCamelCase__				,		initializer_range=self.initializer_range				,		is_hybrid=self.is_hybrid				,		backbone_config=UpperCamelCase__				,		backbone_featmap_shape=self.backbone_featmap_shape				,		)






		def SCREAMING_SNAKE_CASE_			(						self      :     Any				,		UpperCamelCase__      :     str				,		UpperCamelCase__      :     Dict				,		UpperCamelCase__      :     List[Any]      )				->					Tuple:
								'''simple docstring'''







								UpperCAmelCase         =     DPTModel(config=UpperCamelCase__      )
								model.to(UpperCamelCase__      )
								model.eval()
								UpperCAmelCase         =     model(UpperCamelCase__      )
								self.parent.assertEqual(result.last_hidden_state.shape				,		(self.batch_size, self.seq_length, self.hidden_size)      )






		def SCREAMING_SNAKE_CASE_			(						self      :     Union[str, Any]				,		UpperCamelCase__      :     Union[str, Any]				,		UpperCamelCase__      :     Optional[int]				,		UpperCamelCase__      :     str      )				->					List[Any]:
								'''simple docstring'''







								UpperCAmelCase         =     self.num_labels
								UpperCAmelCase         =     DPTForDepthEstimation(UpperCamelCase__      )
								model.to(UpperCamelCase__      )
								model.eval()
								UpperCAmelCase         =     model(UpperCamelCase__      )
								self.parent.assertEqual(result.predicted_depth.shape				,		(self.batch_size, self.image_size, self.image_size)      )






		def SCREAMING_SNAKE_CASE_			(						self      :     Union[str, Any]				,		UpperCamelCase__      :     Union[str, Any]				,		UpperCamelCase__      :     Any				,		UpperCamelCase__      :     Union[str, Any]      )				->					Any:
								'''simple docstring'''







								UpperCAmelCase         =     self.num_labels
								UpperCAmelCase         =     DPTForSemanticSegmentation(UpperCamelCase__      )
								model.to(UpperCamelCase__      )
								model.eval()
								UpperCAmelCase         =     model(UpperCamelCase__				,		labels=UpperCamelCase__      )
								self.parent.assertEqual(
								    result.logits.shape				,		(self.batch_size, self.num_labels, self.image_size, self.image_size)      )







		def SCREAMING_SNAKE_CASE_			(						self      :     List[str]      )				->					Optional[int]:
								'''simple docstring'''







								UpperCAmelCase         =     self.prepare_config_and_inputs()
								UpperCAmelCase       ,		UpperCAmelCase       ,		UpperCAmelCase         =     config_and_inputs
								UpperCAmelCase         =     {"pixel_values": pixel_values}
								return config, inputs_dict





@require_torch
class  __magic_name__   (							A__,  A__,  unittest.TestCase						):
		lowercase      :       Optional[int]          =(DPTModel, DPTForDepthEstimation, DPTForSemanticSegmentation) if is_torch_available() else ()
		lowercase      :       str          =(
		    {
		        '''depth-estimation''': DPTForDepthEstimation,
		        '''feature-extraction''': DPTModel,
		        '''image-segmentation''': DPTForSemanticSegmentation,
		    }
		    if is_torch_available()
		    else {}
		)

		lowercase      :       Any          =False
		lowercase      :       List[str]          =False
		lowercase      :       Optional[Any]          =False






		def SCREAMING_SNAKE_CASE_			(						self      :     Optional[int]      )				->					Any:
								'''simple docstring'''







								UpperCAmelCase         =     DPTModelTester(self      )
								UpperCAmelCase         =     ConfigTester(self				,		config_class=UpperCamelCase__				,		has_text_modality=UpperCamelCase__				,		hidden_size=37      )






		def SCREAMING_SNAKE_CASE_			(						self      :     int      )				->					Tuple:
								'''simple docstring'''







								self.config_tester.run_common_tests()






		@unittest.skip(reason="DPT does not use inputs_embeds"      )
		def SCREAMING_SNAKE_CASE_			(						self      :     Optional[Any]      )				->					Any:
								'''simple docstring'''







								pass






		def SCREAMING_SNAKE_CASE_			(						self      :     List[str]      )				->					List[Any]:
								'''simple docstring'''







								UpperCAmelCase       ,		UpperCAmelCase         =     self.model_tester.prepare_config_and_inputs_for_common()

								for model_class in self.all_model_classes:
														UpperCAmelCase         =     model_class(UpperCamelCase__      )
														self.assertIsInstance(model.get_input_embeddings()				,		(nn.Module)      )
														UpperCAmelCase         =     model.get_output_embeddings()
														self.assertTrue(x is None or isinstance(UpperCamelCase__				,		nn.Linear      )      )






		def SCREAMING_SNAKE_CASE_			(						self      :     Tuple      )				->					List[Any]:
								'''simple docstring'''







								UpperCAmelCase       ,		UpperCAmelCase         =     self.model_tester.prepare_config_and_inputs_for_common()

								for model_class in self.all_model_classes:
														UpperCAmelCase         =     model_class(UpperCamelCase__      )
														UpperCAmelCase         =     inspect.signature(model.forward      )
														# signature.parameters is an OrderedDict => so arg_names order is deterministic
														UpperCAmelCase         =     [*signature.parameters.keys()]

														UpperCAmelCase         =     ["pixel_values"]
														self.assertListEqual(arg_names[:1]				,		UpperCamelCase__      )






		def SCREAMING_SNAKE_CASE_			(						self      :     Any      )				->					int:
								'''simple docstring'''







								UpperCAmelCase         =     self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_model(*UpperCamelCase__      )






		def SCREAMING_SNAKE_CASE_			(						self      :     int      )				->					str:
								'''simple docstring'''







								UpperCAmelCase         =     self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_for_depth_estimation(*UpperCamelCase__      )






		def SCREAMING_SNAKE_CASE_			(						self      :     str      )				->					List[Any]:
								'''simple docstring'''







								UpperCAmelCase         =     self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_for_semantic_segmentation(*UpperCamelCase__      )






		def SCREAMING_SNAKE_CASE_			(						self      :     Tuple      )				->					Tuple:
								'''simple docstring'''







								for model_class in self.all_model_classes:
														if model_class.__name__ == "DPTForDepthEstimation":
																				continue

														UpperCAmelCase       ,		UpperCAmelCase         =     self.model_tester.prepare_config_and_inputs_for_common()
														UpperCAmelCase         =     True

														if model_class in get_values(UpperCamelCase__      ):
																				continue

														UpperCAmelCase         =     model_class(UpperCamelCase__      )
														model.to(UpperCamelCase__      )
														model.train()
														UpperCAmelCase         =     self._prepare_for_class(UpperCamelCase__				,		UpperCamelCase__				,		return_labels=UpperCamelCase__      )
														UpperCAmelCase         =     model(**UpperCamelCase__      ).loss
														loss.backward()






		def SCREAMING_SNAKE_CASE_			(						self      :     Tuple      )				->					Tuple:
								'''simple docstring'''







								for model_class in self.all_model_classes:
														if model_class.__name__ == "DPTForDepthEstimation":
																				continue

														UpperCAmelCase       ,		UpperCAmelCase         =     self.model_tester.prepare_config_and_inputs_for_common()
														UpperCAmelCase         =     False
														UpperCAmelCase         =     True

														if model_class in get_values(UpperCamelCase__      ) or not model_class.supports_gradient_checkpointing:
																				continue
														UpperCAmelCase         =     model_class(UpperCamelCase__      )
														model.to(UpperCamelCase__      )
														model.gradient_checkpointing_enable()
														model.train()
														UpperCAmelCase         =     self._prepare_for_class(UpperCamelCase__				,		UpperCamelCase__				,		return_labels=UpperCamelCase__      )
														UpperCAmelCase         =     model(**UpperCamelCase__      ).loss
														loss.backward()






		def SCREAMING_SNAKE_CASE_			(						self      :     int      )				->					List[str]:
								'''simple docstring'''







								UpperCAmelCase       ,		UpperCAmelCase         =     self.model_tester.prepare_config_and_inputs_for_common()

								UpperCAmelCase         =     _config_zero_init(UpperCamelCase__      )
								for model_class in self.all_model_classes:
														UpperCAmelCase         =     model_class(config=UpperCamelCase__      )
														# Skip the check for the backbone
														UpperCAmelCase         =     []
														for name, module in model.named_modules():
																				if module.__class__.__name__ == "DPTViTHybridEmbeddings":
																										UpperCAmelCase         =     [F'{name}.{key}' for key in module.state_dict().keys()]
																										break

														for name, param in model.named_parameters():
																				if param.requires_grad:
																										if name in backbone_params:
																																continue
																										self.assertIn(
																										    ((param.data.mean() * 1e9).round() / 1e9).item()				,		[0.0, 1.0]				,		msg=F'Parameter {name} of model {model_class} seems not properly initialized'				,		)






		@unittest.skip("Will be fixed soon by reducing the size of the model used for common tests."      )
		def SCREAMING_SNAKE_CASE_			(						self      :     Tuple      )				->					Any:
								'''simple docstring'''







								pass






		@slow
		def SCREAMING_SNAKE_CASE_			(						self      :     Union[str, Any]      )				->					List[str]:
								'''simple docstring'''







								for model_name in DPT_PRETRAINED_MODEL_ARCHIVE_LIST[1:]:
														UpperCAmelCase         =     DPTModel.from_pretrained(UpperCamelCase__      )
														self.assertIsNotNone(UpperCamelCase__      )







		def SCREAMING_SNAKE_CASE_			(						self      :     List[Any]      )				->					Any:
								'''simple docstring'''







								UpperCAmelCase       ,		UpperCAmelCase         =     self.model_tester.prepare_config_and_inputs_for_common()
								UpperCAmelCase         =     "add"
								with self.assertRaises(UpperCamelCase__      ):
														UpperCAmelCase         =     DPTForDepthEstimation(UpperCamelCase__      )

def    lowerCamelCase_() ->       List[Any]:
						UpperCAmelCase         =     Image.open("./tests/fixtures/tests_samples/COCO/000000039769.png"    )
						return image





@require_torch
@require_vision
@slow
class  __magic_name__   (							unittest.TestCase						):






		def SCREAMING_SNAKE_CASE_			(						self      :     List[str]      )				->					Optional[int]:
								'''simple docstring'''







								UpperCAmelCase         =     DPTImageProcessor.from_pretrained("Intel/dpt-hybrid-midas"      )
								UpperCAmelCase         =     DPTForDepthEstimation.from_pretrained("Intel/dpt-hybrid-midas"      ).to(UpperCamelCase__      )

								UpperCAmelCase         =     prepare_img()
								UpperCAmelCase         =     image_processor(images=UpperCamelCase__				,		return_tensors="pt"      ).to(UpperCamelCase__      )

								# forward pass
								with torch.no_grad():
														UpperCAmelCase         =     model(**UpperCamelCase__      )
														UpperCAmelCase         =     outputs.predicted_depth

								# verify the predicted depth
								UpperCAmelCase         =     torch.Size((1, 3_84, 3_84)      )
								self.assertEqual(predicted_depth.shape				,		UpperCamelCase__      )

								UpperCAmelCase         =     torch.tensor(
								    [[[5.64_37, 5.61_46, 5.65_11], [5.43_71, 5.56_49, 5.59_58], [5.52_15, 5.51_84, 5.52_93]]]      ).to(UpperCamelCase__      )

								self.assertTrue(torch.allclose(outputs.predicted_depth[:3, :3, :3] / 1_00				,		UpperCamelCase__				,		atol=1e-4      )      )








from typing import Dict, List, Optional, Union

import numpy as np

from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict
from ...image_transforms import (
    center_crop,
    get_resize_output_image_size,
    normalize,
    rescale,
    resize,
    to_channel_dimension_format,
)
from ...image_utils import (
    IMAGENET_STANDARD_MEAN,
    IMAGENET_STANDARD_STD,
    ChannelDimension,
    ImageInput,
    PILImageResampling,
    make_list_of_images,
    to_numpy_array,
    valid_images,
)
from ...utils import TensorType, is_vision_available, logging


if is_vision_available():
		import PIL


__lowerCamelCase     :							List[Any]  							=				logging.get_logger(__name__)





class  __magic_name__   (							A__						):
		lowercase      :       Tuple          =['''pixel_values''']






		def __init__(						self      :     Any				,		UpperCamelCase__      :     bool = True				,		UpperCamelCase__      :     Dict[str, int] = None				,		UpperCamelCase__      :     float = None				,		UpperCamelCase__      :     PILImageResampling = PILImageResampling.BILINEAR				,		UpperCamelCase__      :     bool = True				,		UpperCamelCase__      :     Union[int, float] = 1 / 2_55				,		UpperCamelCase__      :     bool = True				,		UpperCamelCase__      :     Optional[Union[float, List[float]]] = None				,		UpperCamelCase__      :     Optional[Union[float, List[float]]] = None				,		**UpperCamelCase__      :     List[str]				,		)				->					None:
								'''simple docstring'''







								super().__init__(**UpperCamelCase__      )
								UpperCAmelCase         =     size if size is not None else {"shortest_edge": 3_84}
								UpperCAmelCase         =     get_size_dict(UpperCamelCase__				,		default_to_square=UpperCamelCase__      )

								UpperCAmelCase         =     do_resize
								UpperCAmelCase         =     size
								# Default value set here for backwards compatibility where the value in config is None
								UpperCAmelCase         =     crop_pct if crop_pct is not None else 2_24 / 2_56
								UpperCAmelCase         =     resample
								UpperCAmelCase         =     do_rescale
								UpperCAmelCase         =     rescale_factor
								UpperCAmelCase         =     do_normalize
								UpperCAmelCase         =     image_mean if image_mean is not None else IMAGENET_STANDARD_MEAN
								UpperCAmelCase         =     image_std if image_std is not None else IMAGENET_STANDARD_STD






		def SCREAMING_SNAKE_CASE_			(						self      :     Any				,		UpperCamelCase__      :     np.ndarray				,		UpperCamelCase__      :     Dict[str, int]				,		UpperCamelCase__      :     float				,		UpperCamelCase__      :     PILImageResampling = PILImageResampling.BICUBIC				,		UpperCamelCase__      :     Optional[Union[str, ChannelDimension]] = None				,		**UpperCamelCase__      :     Union[str, Any]				,		)				->					np.ndarray:
								'''simple docstring'''







								UpperCAmelCase         =     get_size_dict(UpperCamelCase__				,		default_to_square=UpperCamelCase__      )
								if "shortest_edge" not in size:
														raise ValueError(F'Size dictionary must contain \'shortest_edge\' key. Got {size.keys()}'      )
								UpperCAmelCase         =     size["shortest_edge"]

								if shortest_edge < 3_84:
														# maintain same ratio, resizing shortest edge to shortest_edge/crop_pct
														UpperCAmelCase         =     int(shortest_edge / crop_pct      )
														UpperCAmelCase         =     get_resize_output_image_size(UpperCamelCase__				,		size=UpperCamelCase__				,		default_to_square=UpperCamelCase__      )
														UpperCAmelCase         =     resize(image=UpperCamelCase__				,		size=UpperCamelCase__				,		resample=UpperCamelCase__				,		data_format=UpperCamelCase__				,		**UpperCamelCase__      )
														# then crop to (shortest_edge, shortest_edge)
														return center_crop(image=UpperCamelCase__				,		size=(shortest_edge, shortest_edge)				,		data_format=UpperCamelCase__				,		**UpperCamelCase__      )
								else:
														# warping (no cropping) when evaluated at 384 or larger
														return resize(
														    UpperCamelCase__				,		size=(shortest_edge, shortest_edge)				,		resample=UpperCamelCase__				,		data_format=UpperCamelCase__				,		**UpperCamelCase__      )






		def SCREAMING_SNAKE_CASE_			(						self      :     Optional[Any]				,		UpperCamelCase__      :     np.ndarray				,		UpperCamelCase__      :     Union[int, float]				,		UpperCamelCase__      :     Optional[Union[str, ChannelDimension]] = None				,		**UpperCamelCase__      :     Optional[Any]				,		)				->					List[str]:
								'''simple docstring'''







								return rescale(UpperCamelCase__				,		scale=UpperCamelCase__				,		data_format=UpperCamelCase__				,		**UpperCamelCase__      )






		def SCREAMING_SNAKE_CASE_			(						self      :     List[str]				,		UpperCamelCase__      :     np.ndarray				,		UpperCamelCase__      :     Union[float, List[float]]				,		UpperCamelCase__      :     Union[float, List[float]]				,		UpperCamelCase__      :     Optional[Union[str, ChannelDimension]] = None				,		**UpperCamelCase__      :     Optional[Any]				,		)				->					np.ndarray:
								'''simple docstring'''







								return normalize(UpperCamelCase__				,		mean=UpperCamelCase__				,		std=UpperCamelCase__				,		data_format=UpperCamelCase__				,		**UpperCamelCase__      )







		def SCREAMING_SNAKE_CASE_			(						self      :     Tuple				,		UpperCamelCase__      :     ImageInput				,		UpperCamelCase__      :     bool = None				,		UpperCamelCase__      :     Dict[str, int] = None				,		UpperCamelCase__      :     float = None				,		UpperCamelCase__      :     PILImageResampling = None				,		UpperCamelCase__      :     bool = None				,		UpperCamelCase__      :     float = None				,		UpperCamelCase__      :     bool = None				,		UpperCamelCase__      :     Optional[Union[float, List[float]]] = None				,		UpperCamelCase__      :     Optional[Union[float, List[float]]] = None				,		UpperCamelCase__      :     Optional[Union[str, TensorType]] = None				,		UpperCamelCase__      :     ChannelDimension = ChannelDimension.FIRST				,		**UpperCamelCase__      :     Any				,		)				->					PIL.Image.Image:
								'''simple docstring'''







								UpperCAmelCase         =     do_resize if do_resize is not None else self.do_resize
								UpperCAmelCase         =     crop_pct if crop_pct is not None else self.crop_pct
								UpperCAmelCase         =     resample if resample is not None else self.resample
								UpperCAmelCase         =     do_rescale if do_rescale is not None else self.do_rescale
								UpperCAmelCase         =     rescale_factor if rescale_factor is not None else self.rescale_factor
								UpperCAmelCase         =     do_normalize if do_normalize is not None else self.do_normalize
								UpperCAmelCase         =     image_mean if image_mean is not None else self.image_mean
								UpperCAmelCase         =     image_std if image_std is not None else self.image_std

								UpperCAmelCase         =     size if size is not None else self.size
								UpperCAmelCase         =     get_size_dict(UpperCamelCase__				,		default_to_square=UpperCamelCase__      )

								UpperCAmelCase         =     make_list_of_images(UpperCamelCase__      )

								if not valid_images(UpperCamelCase__      ):
														raise ValueError(
														    "Invalid image type. Must be of type PIL.Image.Image, numpy.ndarray, "
														    "torch.Tensor, tf.Tensor or jax.ndarray."      )

								if do_resize and size is None or resample is None:
														raise ValueError("Size and resample must be specified if do_resize is True."      )

								if do_resize and size["shortest_edge"] < 3_84 and crop_pct is None:
														raise ValueError("crop_pct must be specified if size < 384."      )

								if do_rescale and rescale_factor is None:
														raise ValueError("Rescale factor must be specified if do_rescale is True."      )

								if do_normalize and (image_mean is None or image_std is None):
														raise ValueError("Image mean and std must be specified if do_normalize is True."      )

								# All transformations expect numpy arrays.
								UpperCAmelCase         =     [to_numpy_array(UpperCamelCase__      ) for image in images]

								if do_resize:
														UpperCAmelCase         =     [self.resize(image=UpperCamelCase__				,		size=UpperCamelCase__				,		crop_pct=UpperCamelCase__				,		resample=UpperCamelCase__      ) for image in images]

								if do_rescale:
														UpperCAmelCase         =     [self.rescale(image=UpperCamelCase__				,		scale=UpperCamelCase__      ) for image in images]

								if do_normalize:
														UpperCAmelCase         =     [self.normalize(image=UpperCamelCase__				,		mean=UpperCamelCase__				,		std=UpperCamelCase__      ) for image in images]

								UpperCAmelCase         =     [to_channel_dimension_format(UpperCamelCase__				,		UpperCamelCase__      ) for image in images]

								UpperCAmelCase         =     {"pixel_values": images}
								return BatchFeature(data=UpperCamelCase__				,		tensor_type=UpperCamelCase__      )



