






import json
import os
from pathlib import Path

import pytest

from datasets.download.download_config import DownloadConfig
from datasets.download.download_manager import DownloadManager
from datasets.utils.file_utils import hash_url_to_filename


__snake_case      :      int             =       """http://www.mocksite.com/file1.txt"""
__snake_case      :      Tuple             =       """\"text\": [\"foo\", \"foo\"]"""
__snake_case      :      str             =       """6d8ce9aa78a471c7477201efbeabd3bb01ac2e7d100a6dc024ba1608361f90a8"""


class       __SCREAMING_SNAKE_CASE   :
      _SCREAMING_SNAKE_CASE		:    Optional[Any]						=   200
      _SCREAMING_SNAKE_CASE		:    Any						=   {'''Content-Length''': '''100'''}
      _SCREAMING_SNAKE_CASE		:    Tuple						=   {}






      def  UpperCamelCase__ (		self       ,  **_UpperCamelCase				):






            """simple docstring"""
            return [bytes(_UpperCamelCase       ,  'utf-8'				)]







def 		_UpperCamelCase				(      *UpperCamelCase_    :   List[str]      ,    **UpperCamelCase_    :   Optional[int]						)					->				Union[str, Any]:

      """simple docstring"""



      return MockResponse()







@pytest.mark.parametrize('urls_type'      ,    [str, list, dict]						)
def 		_UpperCamelCase				(      UpperCamelCase_    :   Any      ,    UpperCamelCase_    :   Dict      ,    UpperCamelCase_    :   Optional[Any]						)					->				Optional[int]:

      """simple docstring"""



      import requests

      monkeypatch.setattr(UpperCamelCase_      ,    'request'      ,    UpperCamelCase_						)

      lowerCAmelCase__        =  URL
      if issubclass(UpperCamelCase_      ,    UpperCamelCase_						):
            lowerCAmelCase__        =  url
      elif issubclass(UpperCamelCase_      ,    UpperCamelCase_						):
            lowerCAmelCase__        =  [url]
      elif issubclass(UpperCamelCase_      ,    UpperCamelCase_						):
            lowerCAmelCase__        =  {'train': url}
      lowerCAmelCase__        =  'dummy'
      lowerCAmelCase__        =  'downloads'
      lowerCAmelCase__        =  tmp_path
      lowerCAmelCase__        =  DownloadConfig(
          cache_dir=os.path.join(UpperCamelCase_      ,    UpperCamelCase_						)      ,    use_etag=UpperCamelCase_      ,    )
      lowerCAmelCase__        =  DownloadManager(dataset_name=UpperCamelCase_      ,    download_config=UpperCamelCase_						)
      lowerCAmelCase__        =  dl_manager.download(UpperCamelCase_						)
      lowerCAmelCase__        =  urls
      for downloaded_paths in [downloaded_paths]:
            if isinstance(UpperCamelCase_      ,    UpperCamelCase_						):
                  lowerCAmelCase__        =  [downloaded_paths]
                  lowerCAmelCase__        =  [urls]
            elif isinstance(UpperCamelCase_      ,    UpperCamelCase_						):
                  assert "train" in downloaded_paths.keys()
                  lowerCAmelCase__        =  downloaded_paths.values()
                  lowerCAmelCase__        =  urls.values()
            assert downloaded_paths
            for downloaded_path, input_url in zip(UpperCamelCase_      ,    UpperCamelCase_						):
                  assert downloaded_path == dl_manager.downloaded_paths[input_url]
                  lowerCAmelCase__        =  Path(UpperCamelCase_						)
                  lowerCAmelCase__        =  downloaded_path.parts
                  assert parts[-1] == HASH
                  assert parts[-2] == cache_subdir
                  assert downloaded_path.exists()
                  lowerCAmelCase__        =  downloaded_path.read_text()
                  assert content == CONTENT
                  lowerCAmelCase__        =  downloaded_path.with_suffix('.json'						)
                  assert metadata_downloaded_path.exists()
                  lowerCAmelCase__        =  json.loads(metadata_downloaded_path.read_text()						)
                  assert metadata_content == {"url": URL, "etag": None}







@pytest.mark.parametrize('paths_type'      ,    [str, list, dict]						)
def 		_UpperCamelCase				(      UpperCamelCase_    :   Tuple      ,    UpperCamelCase_    :   Optional[Any]      ,    UpperCamelCase_    :   int						)					->				Optional[int]:

      """simple docstring"""



      lowerCAmelCase__        =  str(UpperCamelCase_						)
      if issubclass(UpperCamelCase_      ,    UpperCamelCase_						):
            lowerCAmelCase__        =  filename
      elif issubclass(UpperCamelCase_      ,    UpperCamelCase_						):
            lowerCAmelCase__        =  [filename]
      elif issubclass(UpperCamelCase_      ,    UpperCamelCase_						):
            lowerCAmelCase__        =  {'train': filename}
      lowerCAmelCase__        =  'dummy'
      lowerCAmelCase__        =  xz_file.parent
      lowerCAmelCase__        =  'extracted'
      lowerCAmelCase__        =  DownloadConfig(
          cache_dir=UpperCamelCase_      ,    use_etag=UpperCamelCase_      ,    )
      lowerCAmelCase__        =  DownloadManager(dataset_name=UpperCamelCase_      ,    download_config=UpperCamelCase_						)
      lowerCAmelCase__        =  dl_manager.extract(UpperCamelCase_						)
      lowerCAmelCase__        =  paths
      for extracted_paths in [extracted_paths]:
            if isinstance(UpperCamelCase_      ,    UpperCamelCase_						):
                  lowerCAmelCase__        =  [extracted_paths]
                  lowerCAmelCase__        =  [paths]
            elif isinstance(UpperCamelCase_      ,    UpperCamelCase_						):
                  assert "train" in extracted_paths.keys()
                  lowerCAmelCase__        =  extracted_paths.values()
                  lowerCAmelCase__        =  paths.values()
            assert extracted_paths
            for extracted_path, input_path in zip(UpperCamelCase_      ,    UpperCamelCase_						):
                  assert extracted_path == dl_manager.extracted_paths[input_path]
                  lowerCAmelCase__        =  Path(UpperCamelCase_						)
                  lowerCAmelCase__        =  extracted_path.parts
                  assert parts[-1] == hash_url_to_filename(UpperCamelCase_      ,    etag=UpperCamelCase_						)
                  assert parts[-2] == extracted_subdir
                  assert extracted_path.exists()
                  lowerCAmelCase__        =  extracted_path.read_text()
                  lowerCAmelCase__        =  text_file.read_text()
                  assert extracted_file_content == expected_file_content







def 		_UpperCamelCase				(      UpperCamelCase_    :   int      ,    UpperCamelCase_    :   Optional[int]						)					->				List[Any]:

      """simple docstring"""



      assert path.endswith('.jsonl'						)
      for num_items, line in enumerate(UpperCamelCase_      ,    start=1						):
            lowerCAmelCase__        =  json.loads(line.decode('utf-8'						)						)
            assert item.keys() == {"col_1", "col_2", "col_3"}
      assert num_items == 4







@pytest.mark.parametrize('archive_jsonl'      ,    ['tar_jsonl_path', 'zip_jsonl_path']						)
def 		_UpperCamelCase				(      UpperCamelCase_    :   Optional[int]      ,    UpperCamelCase_    :   str						)					->				Optional[Any]:

      """simple docstring"""



      lowerCAmelCase__        =  request.getfixturevalue(UpperCamelCase_						)
      lowerCAmelCase__        =  DownloadManager()
      for num_jsonl, (path, file) in enumerate(dl_manager.iter_archive(UpperCamelCase_						)      ,    start=1						):
            _test_jsonl(UpperCamelCase_      ,    UpperCamelCase_						)
      assert num_jsonl == 2







@pytest.mark.parametrize('archive_nested_jsonl'      ,    ['tar_nested_jsonl_path', 'zip_nested_jsonl_path']						)
def 		_UpperCamelCase				(      UpperCamelCase_    :   Dict      ,    UpperCamelCase_    :   Dict						)					->				Optional[Any]:

      """simple docstring"""



      lowerCAmelCase__        =  request.getfixturevalue(UpperCamelCase_						)
      lowerCAmelCase__        =  DownloadManager()
      for num_tar, (path, file) in enumerate(dl_manager.iter_archive(UpperCamelCase_						)      ,    start=1						):
            for num_jsonl, (subpath, subfile) in enumerate(dl_manager.iter_archive(UpperCamelCase_						)      ,    start=1						):
                  _test_jsonl(UpperCamelCase_      ,    UpperCamelCase_						)
      assert num_tar == 1
      assert num_jsonl == 2







def 		_UpperCamelCase				(      UpperCamelCase_    :   Optional[Any]						)					->				int:

      """simple docstring"""



      lowerCAmelCase__        =  DownloadManager()
      for num_file, file in enumerate(dl_manager.iter_files(UpperCamelCase_						)      ,    start=1						):
            assert os.path.basename(UpperCamelCase_						) == ("test.txt" if num_file == 1 else "train.txt")
      assert num_file == 2













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 DeformableDetrImageProcessor


class       __SCREAMING_SNAKE_CASE   (				unittest.TestCase):






						def __init__(		self       ,  _UpperCamelCase       ,  _UpperCamelCase=7       ,  _UpperCamelCase=3       ,  _UpperCamelCase=30       ,  _UpperCamelCase=4_00       ,  _UpperCamelCase=True       ,  _UpperCamelCase=None       ,  _UpperCamelCase=True       ,  _UpperCamelCase=[0.5, 0.5, 0.5]       ,  _UpperCamelCase=[0.5, 0.5, 0.5]       ,  _UpperCamelCase=True       ,  _UpperCamelCase=1 / 2_55       ,  _UpperCamelCase=True       ,  ):






												"""simple docstring"""
												# by setting size["longest_edge"] > max_resolution we're effectively not testing this :p
												lowerCAmelCase__        =  size if size is not None else {'shortest_edge': 18, 'longest_edge': 13_33}
												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  UpperCamelCase__ (		self				):






												"""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  UpperCamelCase__ (		self       ,  _UpperCamelCase       ,  _UpperCamelCase=False				):






												"""simple docstring"""
												if not batched:
																		lowerCAmelCase__        =  image_inputs[0]
																		if isinstance(_UpperCamelCase       ,  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(_UpperCamelCase       ,  key=lambda _UpperCamelCase				: item[0]				)[0]
																		lowerCAmelCase__        =  max(_UpperCamelCase       ,  key=lambda _UpperCamelCase				: item[1]				)[1]

												return expected_height, expected_width




@require_torch
@require_vision
class       __SCREAMING_SNAKE_CASE   (				__lowercase						,   unittest.TestCase):
						_SCREAMING_SNAKE_CASE		:    Dict						=   DeformableDetrImageProcessor if is_vision_available() else None






						def  UpperCamelCase__ (		self				):






												"""simple docstring"""
												lowerCAmelCase__        =  DeformableDetrImageProcessingTester(self				)






						@property
						def  UpperCamelCase__ (		self				):






												"""simple docstring"""
												return self.image_processor_tester.prepare_image_processor_dict()






						def  UpperCamelCase__ (		self				):






												"""simple docstring"""
												lowerCAmelCase__        =  self.image_processing_class(**self.image_processor_dict				)
												self.assertTrue(hasattr(_UpperCamelCase       ,  'image_mean'				)				)
												self.assertTrue(hasattr(_UpperCamelCase       ,  'image_std'				)				)
												self.assertTrue(hasattr(_UpperCamelCase       ,  'do_normalize'				)				)
												self.assertTrue(hasattr(_UpperCamelCase       ,  'do_resize'				)				)
												self.assertTrue(hasattr(_UpperCamelCase       ,  'do_rescale'				)				)
												self.assertTrue(hasattr(_UpperCamelCase       ,  'do_pad'				)				)
												self.assertTrue(hasattr(_UpperCamelCase       ,  'size'				)				)






						def  UpperCamelCase__ (		self				):






												"""simple docstring"""
												lowerCAmelCase__        =  self.image_processing_class.from_dict(self.image_processor_dict				)
												self.assertEqual(image_processor.size       ,  {'shortest_edge': 18, 'longest_edge': 13_33}				)
												self.assertEqual(image_processor.do_pad       ,  _UpperCamelCase				)

												lowerCAmelCase__        =  self.image_processing_class.from_dict(
												    self.image_processor_dict       ,  size=42       ,  max_size=84       ,  pad_and_return_pixel_mask=_UpperCamelCase				)
												self.assertEqual(image_processor.size       ,  {'shortest_edge': 42, 'longest_edge': 84}				)
												self.assertEqual(image_processor.do_pad       ,  _UpperCamelCase				)






						def  UpperCamelCase__ (		self				):






												"""simple docstring"""
												pass






						def  UpperCamelCase__ (		self				):






												"""simple docstring"""
												# Initialize image_processing
												lowerCAmelCase__        =  self.image_processing_class(**self.image_processor_dict				)
												# create random PIL images
												lowerCAmelCase__        =  prepare_image_inputs(self.image_processor_tester       ,  equal_resolution=_UpperCamelCase				)
												for image in image_inputs:
																		self.assertIsInstance(_UpperCamelCase       ,  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(_UpperCamelCase				)

												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(_UpperCamelCase       ,  batched=_UpperCamelCase				)

												lowerCAmelCase__        =  image_processing(_UpperCamelCase       ,  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  UpperCamelCase__ (		self				):






												"""simple docstring"""
												# Initialize image_processing
												lowerCAmelCase__        =  self.image_processing_class(**self.image_processor_dict				)
												# create random numpy tensors
												lowerCAmelCase__        =  prepare_image_inputs(self.image_processor_tester       ,  equal_resolution=_UpperCamelCase       ,  numpify=_UpperCamelCase				)
												for image in image_inputs:
																		self.assertIsInstance(_UpperCamelCase       ,  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(_UpperCamelCase				)

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

												# Test batched
												lowerCAmelCase__        =  image_processing(_UpperCamelCase       ,  return_tensors='pt'				).pixel_values

												lowerCAmelCase__  ,    lowerCAmelCase__        =  self.image_processor_tester.get_expected_values(_UpperCamelCase       ,  batched=_UpperCamelCase				)

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






						def  UpperCamelCase__ (		self				):






												"""simple docstring"""
												# Initialize image_processing
												lowerCAmelCase__        =  self.image_processing_class(**self.image_processor_dict				)
												# create random PyTorch tensors
												lowerCAmelCase__        =  prepare_image_inputs(self.image_processor_tester       ,  equal_resolution=_UpperCamelCase       ,  torchify=_UpperCamelCase				)
												for image in image_inputs:
																		self.assertIsInstance(_UpperCamelCase       ,  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(_UpperCamelCase				)

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

												# Test batched
												lowerCAmelCase__        =  image_processing(_UpperCamelCase       ,  return_tensors='pt'				).pixel_values

												lowerCAmelCase__  ,    lowerCAmelCase__        =  self.image_processor_tester.get_expected_values(_UpperCamelCase       ,  batched=_UpperCamelCase				)

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






						@slow
						def  UpperCamelCase__ (		self				):






												"""simple docstring"""
												# prepare image and target
												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': 3_97_69, 'annotations': target}

												# encode them
												lowerCAmelCase__        =  DeformableDetrImageProcessor()
												lowerCAmelCase__        =  image_processing(images=_UpperCamelCase       ,  annotations=_UpperCamelCase       ,  return_tensors='pt'				)

												# verify pixel values
												lowerCAmelCase__        =  torch.Size([1, 3, 8_00, 10_66]				)
												self.assertEqual(encoding['pixel_values'].shape       ,  _UpperCamelCase				)

												lowerCAmelCase__        =  torch.tensor([0.27_96, 0.31_38, 0.34_81]				)
												self.assertTrue(torch.allclose(encoding['pixel_values'][0, 0, 0, :3]       ,  _UpperCamelCase       ,  atol=1E-4				)				)

												# verify area
												lowerCAmelCase__        =  torch.tensor([58_87.96_00, 1_12_50.20_61, 48_93_53.84_38, 83_71_22.75_00, 14_79_67.51_56, 16_57_32.34_38]				)
												self.assertTrue(torch.allclose(encoding['labels'][0]['area']       ,  _UpperCamelCase				)				)
												# verify boxes
												lowerCAmelCase__        =  torch.Size([6, 4]				)
												self.assertEqual(encoding['labels'][0]['boxes'].shape       ,  _UpperCamelCase				)
												lowerCAmelCase__        =  torch.tensor([0.55_03, 0.27_65, 0.06_04, 0.22_15]				)
												self.assertTrue(torch.allclose(encoding['labels'][0]['boxes'][0]       ,  _UpperCamelCase       ,  atol=1E-3				)				)
												# verify image_id
												lowerCAmelCase__        =  torch.tensor([3_97_69]				)
												self.assertTrue(torch.allclose(encoding['labels'][0]['image_id']       ,  _UpperCamelCase				)				)
												# verify is_crowd
												lowerCAmelCase__        =  torch.tensor([0, 0, 0, 0, 0, 0]				)
												self.assertTrue(torch.allclose(encoding['labels'][0]['iscrowd']       ,  _UpperCamelCase				)				)
												# verify class_labels
												lowerCAmelCase__        =  torch.tensor([75, 75, 63, 65, 17, 17]				)
												self.assertTrue(torch.allclose(encoding['labels'][0]['class_labels']       ,  _UpperCamelCase				)				)
												# verify orig_size
												lowerCAmelCase__        =  torch.tensor([4_80, 6_40]				)
												self.assertTrue(torch.allclose(encoding['labels'][0]['orig_size']       ,  _UpperCamelCase				)				)
												# verify size
												lowerCAmelCase__        =  torch.tensor([8_00, 10_66]				)
												self.assertTrue(torch.allclose(encoding['labels'][0]['size']       ,  _UpperCamelCase				)				)







						@slow
						def  UpperCamelCase__ (		self				):






												"""simple docstring"""
												# prepare image, target and masks_path
												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': 3_97_69, 'segments_info': target}

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

												# encode them
												lowerCAmelCase__        =  DeformableDetrImageProcessor(format='coco_panoptic'				)
												lowerCAmelCase__        =  image_processing(images=_UpperCamelCase       ,  annotations=_UpperCamelCase       ,  masks_path=_UpperCamelCase       ,  return_tensors='pt'				)

												# verify pixel values
												lowerCAmelCase__        =  torch.Size([1, 3, 8_00, 10_66]				)
												self.assertEqual(encoding['pixel_values'].shape       ,  _UpperCamelCase				)

												lowerCAmelCase__        =  torch.tensor([0.27_96, 0.31_38, 0.34_81]				)
												self.assertTrue(torch.allclose(encoding['pixel_values'][0, 0, 0, :3]       ,  _UpperCamelCase       ,  atol=1E-4				)				)

												# verify area
												lowerCAmelCase__        =  torch.tensor([14_79_79.68_75, 16_55_27.04_69, 48_46_38.59_38, 1_12_92.93_75, 58_79.65_62, 76_34.11_47]				)
												self.assertTrue(torch.allclose(encoding['labels'][0]['area']       ,  _UpperCamelCase				)				)
												# verify boxes
												lowerCAmelCase__        =  torch.Size([6, 4]				)
												self.assertEqual(encoding['labels'][0]['boxes'].shape       ,  _UpperCamelCase				)
												lowerCAmelCase__        =  torch.tensor([0.26_25, 0.54_37, 0.46_88, 0.86_25]				)
												self.assertTrue(torch.allclose(encoding['labels'][0]['boxes'][0]       ,  _UpperCamelCase       ,  atol=1E-3				)				)
												# verify image_id
												lowerCAmelCase__        =  torch.tensor([3_97_69]				)
												self.assertTrue(torch.allclose(encoding['labels'][0]['image_id']       ,  _UpperCamelCase				)				)
												# verify is_crowd
												lowerCAmelCase__        =  torch.tensor([0, 0, 0, 0, 0, 0]				)
												self.assertTrue(torch.allclose(encoding['labels'][0]['iscrowd']       ,  _UpperCamelCase				)				)
												# verify class_labels
												lowerCAmelCase__        =  torch.tensor([17, 17, 63, 75, 75, 93]				)
												self.assertTrue(torch.allclose(encoding['labels'][0]['class_labels']       ,  _UpperCamelCase				)				)
												# verify masks
												lowerCAmelCase__        =  82_28_73
												self.assertEqual(encoding['labels'][0]['masks'].sum().item()       ,  _UpperCamelCase				)
												# verify orig_size
												lowerCAmelCase__        =  torch.tensor([4_80, 6_40]				)
												self.assertTrue(torch.allclose(encoding['labels'][0]['orig_size']       ,  _UpperCamelCase				)				)
												# verify size
												lowerCAmelCase__        =  torch.tensor([8_00, 10_66]				)
												self.assertTrue(torch.allclose(encoding['labels'][0]['size']       ,  _UpperCamelCase				)				)





