




import json
import pathlib
import unittest

import numpy as np

from transformers.testing_utils import require_torch, require_vision, slow
from transformers.utils import is_torch_available, is_vision_available

from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs


if is_torch_available():
 import torch

if is_vision_available():
 from PIL import Image

 from transformers import DetaImageProcessor







class   A(						unittest.TestCase   ):



 '''simple docstring'''


 def __init__(				self					:  Union[str, Any]						,							A_					:  List[Any]						,							A_					:  Dict=7						,							A_					:  str=3						,							A_					:  Tuple=30						,							A_					:  int=400						,							A_					:  int=True						,							A_					:  Tuple=None						,							A_					:  Optional[int]=True						,							A_					:  Tuple=[0.5, 0.5, 0.5]						,							A_					:  Union[str, Any]=[0.5, 0.5, 0.5]						,							A_					:  List[Any]=True						,							A_					:  Optional[int]=1 / 255						,							A_					:  List[str]=True						,							)   ->	Any:

       """simple docstring"""






       lowerCamelCase_		     =    size if size is not None else {'shortest_edge': 18, 'longest_edge': 1333}
       lowerCamelCase_		     =    parent
       lowerCamelCase_		     =    batch_size
       lowerCamelCase_		     =    num_channels
       lowerCamelCase_		     =    min_resolution
       lowerCamelCase_		     =    max_resolution
       lowerCamelCase_		     =    do_resize
       lowerCamelCase_		     =    size
       lowerCamelCase_		     =    do_normalize
       lowerCamelCase_		     =    image_mean
       lowerCamelCase_		     =    image_std
       lowerCamelCase_		     =    do_rescale
       lowerCamelCase_		     =    rescale_factor
       lowerCamelCase_		     =    do_pad

 def 				a__ (				self					:  Tuple  )   ->	int:

       """simple docstring"""






       return {
           "do_resize": self.do_resize,
           "size": self.size,
           "do_normalize": self.do_normalize,
           "image_mean": self.image_mean,
           "image_std": self.image_std,
           "do_rescale": self.do_rescale,
           "rescale_factor": self.rescale_factor,
           "do_pad": self.do_pad,
       }





 def 				a__ (				self					:  Optional[int]						,							A_					:  Any						,							A_					:  int=False  )   ->	str:

       """simple docstring"""






       if not batched:
             lowerCamelCase_		     =    image_inputs[0]
             if isinstance(A_						,							Image.Image  ):
                   lowerCamelCase_     ,				lowerCamelCase_		     =    image.size
             else:
                   lowerCamelCase_     ,				lowerCamelCase_		     =    image.shape[1], image.shape[2]
             if w < h:
                   lowerCamelCase_		     =    int(self.size['shortest_edge'] * h / w  )
                   lowerCamelCase_		     =    self.size['shortest_edge']
             elif w > h:
                   lowerCamelCase_		     =    self.size['shortest_edge']
                   lowerCamelCase_		     =    int(self.size['shortest_edge'] * w / h  )
             else:
                   lowerCamelCase_		     =    self.size['shortest_edge']
                   lowerCamelCase_		     =    self.size['shortest_edge']

       else:
             lowerCamelCase_		     =    []
             for image in image_inputs:
                   lowerCamelCase_     ,				lowerCamelCase_		     =    self.get_expected_values([image]  )
                   expected_values.append((expected_height, expected_width)  )
             lowerCamelCase_		     =    max(A_						,							key=lambda A_  : item[0]  )[0]
             lowerCamelCase_		     =    max(A_						,							key=lambda A_  : item[1]  )[1]

       return expected_height, expected_width







@require_torch
@require_vision
class   A(						UpperCamelCase							,      unittest.TestCase   ):



 '''simple docstring'''


 UpperCamelCase						   =						DetaImageProcessor if is_vision_available() else None

 def 				a__ (				self					:  int  )   ->	Optional[Any]:

       """simple docstring"""






       lowerCamelCase_		     =    DetaImageProcessingTester(self  )

 @property
 def 				a__ (				self					:  int  )   ->	Optional[int]:

       """simple docstring"""






       return self.image_processor_tester.prepare_image_processor_dict()

 def 				a__ (				self					:  Optional[Any]  )   ->	List[Any]:

       """simple docstring"""






       lowerCamelCase_		     =    self.image_processing_class(**self.image_processor_dict  )
       self.assertTrue(hasattr(A_						,							'image_mean'  )  )
       self.assertTrue(hasattr(A_						,							'image_std'  )  )
       self.assertTrue(hasattr(A_						,							'do_normalize'  )  )
       self.assertTrue(hasattr(A_						,							'do_resize'  )  )
       self.assertTrue(hasattr(A_						,							'do_rescale'  )  )
       self.assertTrue(hasattr(A_						,							'do_pad'  )  )
       self.assertTrue(hasattr(A_						,							'size'  )  )

 def 				a__ (				self					:  int  )   ->	Optional[int]:

       """simple docstring"""






       lowerCamelCase_		     =    self.image_processing_class.from_dict(self.image_processor_dict  )
       self.assertEqual(image_processor.size						,							{'shortest_edge': 18, 'longest_edge': 1333}  )
       self.assertEqual(image_processor.do_pad						,							A_  )

 def 				a__ (				self					:  Optional[Any]  )   ->	Any:

       """simple docstring"""






       pass

 def 				a__ (				self					:  Union[str, Any]  )   ->	str:

       """simple docstring"""






       lowerCamelCase_		     =    self.image_processing_class(**self.image_processor_dict  )
       # create random PIL images
       lowerCamelCase_		     =    prepare_image_inputs(self.image_processor_tester						,							equal_resolution=A_  )
       for image in image_inputs:
             self.assertIsInstance(A_						,							Image.Image  )

       # Test not batched input
       lowerCamelCase_		     =    image_processing(image_inputs[0]						,							return_tensors='pt'  ).pixel_values

       lowerCamelCase_     ,				lowerCamelCase_		     =    self.image_processor_tester.get_expected_values(A_  )

       self.assertEqual(
           encoded_images.shape						,							(1, self.image_processor_tester.num_channels, expected_height, expected_width)						,							)

       # Test batched
       lowerCamelCase_     ,				lowerCamelCase_		     =    self.image_processor_tester.get_expected_values(A_						,							batched=A_  )

       lowerCamelCase_		     =    image_processing(A_						,							return_tensors='pt'  ).pixel_values
       self.assertEqual(
           encoded_images.shape						,							(
               self.image_processor_tester.batch_size,
               self.image_processor_tester.num_channels,
               expected_height,
               expected_width,
           )						,							)

 def 				a__ (				self					:  Optional[int]  )   ->	List[str]:

       """simple docstring"""






       lowerCamelCase_		     =    self.image_processing_class(**self.image_processor_dict  )
       # create random numpy tensors
       lowerCamelCase_		     =    prepare_image_inputs(self.image_processor_tester						,							equal_resolution=A_						,							numpify=A_  )
       for image in image_inputs:
             self.assertIsInstance(A_						,							np.ndarray  )

       # Test not batched input
       lowerCamelCase_		     =    image_processing(image_inputs[0]						,							return_tensors='pt'  ).pixel_values

       lowerCamelCase_     ,				lowerCamelCase_		     =    self.image_processor_tester.get_expected_values(A_  )

       self.assertEqual(
           encoded_images.shape						,							(1, self.image_processor_tester.num_channels, expected_height, expected_width)						,							)

       # Test batched
       lowerCamelCase_		     =    image_processing(A_						,							return_tensors='pt'  ).pixel_values

       lowerCamelCase_     ,				lowerCamelCase_		     =    self.image_processor_tester.get_expected_values(A_						,							batched=A_  )

       self.assertEqual(
           encoded_images.shape						,							(
               self.image_processor_tester.batch_size,
               self.image_processor_tester.num_channels,
               expected_height,
               expected_width,
           )						,							)

 def 				a__ (				self					:  int  )   ->	Tuple:

       """simple docstring"""






       lowerCamelCase_		     =    self.image_processing_class(**self.image_processor_dict  )
       # create random PyTorch tensors
       lowerCamelCase_		     =    prepare_image_inputs(self.image_processor_tester						,							equal_resolution=A_						,							torchify=A_  )
       for image in image_inputs:
             self.assertIsInstance(A_						,							torch.Tensor  )

       # Test not batched input
       lowerCamelCase_		     =    image_processing(image_inputs[0]						,							return_tensors='pt'  ).pixel_values

       lowerCamelCase_     ,				lowerCamelCase_		     =    self.image_processor_tester.get_expected_values(A_  )

       self.assertEqual(
           encoded_images.shape						,							(1, self.image_processor_tester.num_channels, expected_height, expected_width)						,							)

       # Test batched
       lowerCamelCase_		     =    image_processing(A_						,							return_tensors='pt'  ).pixel_values

       lowerCamelCase_     ,				lowerCamelCase_		     =    self.image_processor_tester.get_expected_values(A_						,							batched=A_  )

       self.assertEqual(
           encoded_images.shape						,							(
               self.image_processor_tester.batch_size,
               self.image_processor_tester.num_channels,
               expected_height,
               expected_width,
           )						,							)

 @slow
 def 				a__ (				self					:  List[Any]  )   ->	List[str]:

       """simple docstring"""






       lowerCamelCase_		     =    Image.open('./tests/fixtures/tests_samples/COCO/000000039769.png'  )
       with open('./tests/fixtures/tests_samples/COCO/coco_annotations.txt'						,							'r'  ) as f:
             lowerCamelCase_		     =    json.loads(f.read()  )

       lowerCamelCase_		     =    {'image_id': 39769, 'annotations': target}

       # encode them
       lowerCamelCase_		     =    DetaImageProcessor()
       lowerCamelCase_		     =    image_processing(images=A_						,							annotations=A_						,							return_tensors='pt'  )

       # verify pixel values
       lowerCamelCase_		     =    torch.Size([1, 3, 800, 1066]  )
       self.assertEqual(encoding['pixel_values'].shape						,							A_  )

       lowerCamelCase_		     =    torch.tensor([0.2796, 0.3138, 0.3481]  )
       self.assertTrue(torch.allclose(encoding['pixel_values'][0, 0, 0, :3]						,							A_						,							atol=1E-4  )  )

       # verify area
       lowerCamelCase_		     =    torch.tensor([5887.9600, 11250.2061, 489353.8438, 837122.7500, 147967.5156, 165732.3438]  )
       self.assertTrue(torch.allclose(encoding['labels'][0]['area']						,							A_  )  )
       # verify boxes
       lowerCamelCase_		     =    torch.Size([6, 4]  )
       self.assertEqual(encoding['labels'][0]['boxes'].shape						,							A_  )
       lowerCamelCase_		     =    torch.tensor([0.5503, 0.2765, 0.0604, 0.2215]  )
       self.assertTrue(torch.allclose(encoding['labels'][0]['boxes'][0]						,							A_						,							atol=1E-3  )  )
       # verify image_id
       lowerCamelCase_		     =    torch.tensor([39769]  )
       self.assertTrue(torch.allclose(encoding['labels'][0]['image_id']						,							A_  )  )
       # verify is_crowd
       lowerCamelCase_		     =    torch.tensor([0, 0, 0, 0, 0, 0]  )
       self.assertTrue(torch.allclose(encoding['labels'][0]['iscrowd']						,							A_  )  )
       # verify class_labels
       lowerCamelCase_		     =    torch.tensor([75, 75, 63, 65, 17, 17]  )
       self.assertTrue(torch.allclose(encoding['labels'][0]['class_labels']						,							A_  )  )
       # verify orig_size
       lowerCamelCase_		     =    torch.tensor([480, 640]  )
       self.assertTrue(torch.allclose(encoding['labels'][0]['orig_size']						,							A_  )  )
       # verify size
       lowerCamelCase_		     =    torch.tensor([800, 1066]  )
       self.assertTrue(torch.allclose(encoding['labels'][0]['size']						,							A_  )  )





 @slow
 def 				a__ (				self					:  Optional[Any]  )   ->	Union[str, Any]:

       """simple docstring"""






       lowerCamelCase_		     =    Image.open('./tests/fixtures/tests_samples/COCO/000000039769.png'  )
       with open('./tests/fixtures/tests_samples/COCO/coco_panoptic_annotations.txt'						,							'r'  ) as f:
             lowerCamelCase_		     =    json.loads(f.read()  )

       lowerCamelCase_		     =    {'file_name': '000000039769.png', 'image_id': 39769, 'segments_info': target}

       lowerCamelCase_		     =    pathlib.Path('./tests/fixtures/tests_samples/COCO/coco_panoptic'  )

       # encode them
       lowerCamelCase_		     =    DetaImageProcessor(format='coco_panoptic'  )
       lowerCamelCase_		     =    image_processing(images=A_						,							annotations=A_						,							masks_path=A_						,							return_tensors='pt'  )

       # verify pixel values
       lowerCamelCase_		     =    torch.Size([1, 3, 800, 1066]  )
       self.assertEqual(encoding['pixel_values'].shape						,							A_  )

       lowerCamelCase_		     =    torch.tensor([0.2796, 0.3138, 0.3481]  )
       self.assertTrue(torch.allclose(encoding['pixel_values'][0, 0, 0, :3]						,							A_						,							atol=1E-4  )  )

       # verify area
       lowerCamelCase_		     =    torch.tensor([147979.6875, 165527.0469, 484638.5938, 11292.9375, 5879.6562, 7634.1147]  )
       self.assertTrue(torch.allclose(encoding['labels'][0]['area']						,							A_  )  )
       # verify boxes
       lowerCamelCase_		     =    torch.Size([6, 4]  )
       self.assertEqual(encoding['labels'][0]['boxes'].shape						,							A_  )
       lowerCamelCase_		     =    torch.tensor([0.2625, 0.5437, 0.4688, 0.8625]  )
       self.assertTrue(torch.allclose(encoding['labels'][0]['boxes'][0]						,							A_						,							atol=1E-3  )  )
       # verify image_id
       lowerCamelCase_		     =    torch.tensor([39769]  )
       self.assertTrue(torch.allclose(encoding['labels'][0]['image_id']						,							A_  )  )
       # verify is_crowd
       lowerCamelCase_		     =    torch.tensor([0, 0, 0, 0, 0, 0]  )
       self.assertTrue(torch.allclose(encoding['labels'][0]['iscrowd']						,							A_  )  )
       # verify class_labels
       lowerCamelCase_		     =    torch.tensor([17, 17, 63, 75, 75, 93]  )
       self.assertTrue(torch.allclose(encoding['labels'][0]['class_labels']						,							A_  )  )
       # verify masks
       lowerCamelCase_		     =    822873
       self.assertEqual(encoding['labels'][0]['masks'].sum().item()						,							A_  )
       # verify orig_size
       lowerCamelCase_		     =    torch.tensor([480, 640]  )
       self.assertTrue(torch.allclose(encoding['labels'][0]['orig_size']						,							A_  )  )
       # verify size
       lowerCamelCase_		     =    torch.tensor([800, 1066]  )
       self.assertTrue(torch.allclose(encoding['labels'][0]['size']						,							A_  )  )









from typing import Dict, Iterable, Optional, Union

import numpy as np

from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict
from ...image_transforms import normalize, rescale, resize, to_channel_dimension_format, to_pil_image
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_pytesseract_available, is_vision_available, logging, requires_backends


if is_vision_available():
 import PIL

# soft dependency
if is_pytesseract_available():
 import pytesseract

lowerCamelCase				:		List[str]     =   logging.get_logger(__name__)

def 			_SCREAMING_SNAKE_CASE			(							lowercase	:       Tuple	,							lowercase	:       Optional[int]	,							lowercase	:       Optional[int]     ):


      '''simple docstring'''



      return [
          int(10_00 * (box[0] / width)     ),
          int(10_00 * (box[1] / height)     ),
          int(10_00 * (box[2] / width)     ),
          int(10_00 * (box[3] / height)     ),
      ]

def 			_SCREAMING_SNAKE_CASE			(							lowercase	:       np.ndarray	,							lowercase	:       Optional[str]	,							lowercase	:       Optional[str]     ):


      '''simple docstring'''



      lowerCamelCase_		     =    to_pil_image(lowercase     )
      lowerCamelCase_     ,				lowerCamelCase_		     =    pil_image.size
      lowerCamelCase_		     =    pytesseract.image_to_data(lowercase	,							lang=lowercase	,							output_type='dict'	,							config=lowercase     )
      lowerCamelCase_     ,				lowerCamelCase_     ,				lowerCamelCase_     ,				lowerCamelCase_     ,				lowerCamelCase_		     =    data['text'], data['left'], data['top'], data['width'], data['height']

      # filter empty words and corresponding coordinates
      lowerCamelCase_		     =    [idx for idx, word in enumerate(lowercase     ) if not word.strip()]
      lowerCamelCase_		     =    [word for idx, word in enumerate(lowercase     ) if idx not in irrelevant_indices]
      lowerCamelCase_		     =    [coord for idx, coord in enumerate(lowercase     ) if idx not in irrelevant_indices]
      lowerCamelCase_		     =    [coord for idx, coord in enumerate(lowercase     ) if idx not in irrelevant_indices]
      lowerCamelCase_		     =    [coord for idx, coord in enumerate(lowercase     ) if idx not in irrelevant_indices]
      lowerCamelCase_		     =    [coord for idx, coord in enumerate(lowercase     ) if idx not in irrelevant_indices]

      # turn coordinates into (left, top, left+width, top+height) format
      lowerCamelCase_		     =    []
      for x, y, w, h in zip(lowercase	,							lowercase	,							lowercase	,							lowercase     ):
            lowerCamelCase_		     =    [x, y, x + w, y + h]
            actual_boxes.append(lowercase     )

      # finally, normalize the bounding boxes
      lowerCamelCase_		     =    []
      for box in actual_boxes:
            normalized_boxes.append(normalize_box(lowercase	,							lowercase	,							lowercase     )     )

      assert len(lowercase     ) == len(lowercase     ), "Not as many words as there are bounding boxes"

      return words, normalized_boxes







class   A(						UpperCamelCase   ):



 '''simple docstring'''


 UpperCamelCase						   =						['''pixel_values''']

 def __init__(				self					:  int						,							A_					:  bool = True						,							A_					:  Dict[str, int] = None						,							A_					:  PILImageResampling = PILImageResampling.BILINEAR						,							A_					:  bool = True						,							A_					:  float = 1 / 255						,							A_					:  bool = True						,							A_					:  Union[float, Iterable[float]] = None						,							A_					:  Union[float, Iterable[float]] = None						,							A_					:  bool = True						,							A_					:  Optional[str] = None						,							A_					:  Optional[str] = ""						,							**A_					:  Optional[int]						,							)   ->	None:

       """simple docstring"""






       super().__init__(**A_  )
       lowerCamelCase_		     =    size if size is not None else {'height': 224, 'width': 224}
       lowerCamelCase_		     =    get_size_dict(A_  )

       lowerCamelCase_		     =    do_resize
       lowerCamelCase_		     =    size
       lowerCamelCase_		     =    resample
       lowerCamelCase_		     =    do_rescale
       lowerCamelCase_		     =    rescale_value
       lowerCamelCase_		     =    do_normalize
       lowerCamelCase_		     =    image_mean if image_mean is not None else IMAGENET_STANDARD_MEAN
       lowerCamelCase_		     =    image_std if image_std is not None else IMAGENET_STANDARD_STD
       lowerCamelCase_		     =    apply_ocr
       lowerCamelCase_		     =    ocr_lang
       lowerCamelCase_		     =    tesseract_config

 def 				a__ (				self					:  str						,							A_					:  np.ndarray						,							A_					:  Dict[str, int]						,							A_					:  PILImageResampling = PILImageResampling.BILINEAR						,							A_					:  Optional[Union[str, ChannelDimension]] = None						,							**A_					:  str						,							)   ->	np.ndarray:

       """simple docstring"""






       lowerCamelCase_		     =    get_size_dict(A_  )
       if "height" not in size or "width" not in size:
             raise ValueError(f"""The size dictionary must contain the keys 'height' and 'width'. Got {size.keys()}"""  )
       lowerCamelCase_		     =    (size['height'], size['width'])
       return resize(A_						,							size=A_						,							resample=A_						,							data_format=A_						,							**A_  )

 def 				a__ (				self					:  Any						,							A_					:  np.ndarray						,							A_					:  Union[int, float]						,							A_					:  Optional[Union[str, ChannelDimension]] = None						,							**A_					:  Optional[Any]						,							)   ->	np.ndarray:

       """simple docstring"""






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

 def 				a__ (				self					:  Union[str, Any]						,							A_					:  np.ndarray						,							A_					:  Union[float, Iterable[float]]						,							A_					:  Union[float, Iterable[float]]						,							A_					:  Optional[Union[str, ChannelDimension]] = None						,							**A_					:  int						,							)   ->	np.ndarray:

       """simple docstring"""






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





 def 				a__ (				self					:  List[Any]						,							A_					:  ImageInput						,							A_					:  bool = None						,							A_					:  Dict[str, int] = None						,							A_					:  Dict=None						,							A_					:  bool = None						,							A_					:  float = None						,							A_					:  bool = None						,							A_					:  Union[float, Iterable[float]] = None						,							A_					:  Union[float, Iterable[float]] = None						,							A_					:  bool = None						,							A_					:  Optional[str] = None						,							A_					:  Optional[str] = None						,							A_					:  Optional[Union[str, TensorType]] = None						,							A_					:  ChannelDimension = ChannelDimension.FIRST						,							**A_					:  Any						,							)   ->	PIL.Image.Image:

       """simple docstring"""






       lowerCamelCase_		     =    do_resize if do_resize is not None else self.do_resize
       lowerCamelCase_		     =    size if size is not None else self.size
       lowerCamelCase_		     =    get_size_dict(A_  )
       lowerCamelCase_		     =    resample if resample is not None else self.resample
       lowerCamelCase_		     =    do_rescale if do_rescale is not None else self.do_rescale
       lowerCamelCase_		     =    rescale_factor if rescale_factor is not None else self.rescale_factor
       lowerCamelCase_		     =    do_normalize if do_normalize is not None else self.do_normalize
       lowerCamelCase_		     =    image_mean if image_mean is not None else self.image_mean
       lowerCamelCase_		     =    image_std if image_std is not None else self.image_std
       lowerCamelCase_		     =    apply_ocr if apply_ocr is not None else self.apply_ocr
       lowerCamelCase_		     =    ocr_lang if ocr_lang is not None else self.ocr_lang
       lowerCamelCase_		     =    tesseract_config if tesseract_config is not None else self.tesseract_config

       lowerCamelCase_		     =    make_list_of_images(A_  )

       if not valid_images(A_  ):
             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:
             raise ValueError('Size must be specified if do_resize is True.'  )

       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('If do_normalize is True, image_mean and image_std must be specified.'  )

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

       # Tesseract OCR to get words + normalized bounding boxes
       if apply_ocr:
             requires_backends(self						,							'pytesseract'  )
             lowerCamelCase_		     =    []
             lowerCamelCase_		     =    []
             for image in images:
                   lowerCamelCase_     ,				lowerCamelCase_		     =    apply_tesseract(A_						,							A_						,							A_  )
                   words_batch.append(A_  )
                   boxes_batch.append(A_  )

       if do_resize:
             lowerCamelCase_		     =    [self.resize(image=A_						,							size=A_						,							resample=A_  ) for image in images]

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

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

       lowerCamelCase_		     =    [to_channel_dimension_format(A_						,							A_  ) for image in images]

       lowerCamelCase_		     =    BatchFeature(data={'pixel_values': images}						,							tensor_type=A_  )

       if apply_ocr:
             lowerCamelCase_		     =    words_batch
             lowerCamelCase_		     =    boxes_batch
       return data



