
from __future__ import annotations

from collections.abc import Callable
from typing import Generic, TypeVar

_lowercase											=    TypeVar("""T""")
_lowercase											=    TypeVar("""U""")


class 			lowercase_		(      Generic[T, U]       ):


       def __init__(    self						,       __A						,       __A				)						->    str:
              SCREAMING_SNAKE_CASE_							:				Optional[int]		=key
              SCREAMING_SNAKE_CASE_							:				str		=val
              SCREAMING_SNAKE_CASE_							:				DoubleLinkedListNode[T, U] | None		=None
              SCREAMING_SNAKE_CASE_							:				DoubleLinkedListNode[T, U] | None		=None





       def __repr__(    self				)						->    str:
              return (
                  F'Node: key: {self.key}, val: {self.val}, '
                  F'has next: {bool(self.next				)}, has prev: {bool(self.prev				)}'
              )






class 			lowercase_		(      Generic[T, U]       ):


       def __init__(    self				)						->    None:
              SCREAMING_SNAKE_CASE_							:				DoubleLinkedListNode[T, U]		=DoubleLinkedListNode(__A						,       __A				)
              SCREAMING_SNAKE_CASE_							:				DoubleLinkedListNode[T, U]		=DoubleLinkedListNode(__A						,       __A				)
              SCREAMING_SNAKE_CASE_	,     SCREAMING_SNAKE_CASE_							:				str		=self.rear, self.head


       def __repr__(    self				)						->    str:
              SCREAMING_SNAKE_CASE_							:				Optional[int]		=['''DoubleLinkedList''']
              SCREAMING_SNAKE_CASE_							:				List[str]		=self.head
              while node.next is not None:
                     rep.append(str(__A				)				)
                     SCREAMING_SNAKE_CASE_							:				Dict		=node.next
              rep.append(str(self.rear				)				)
              return ",\n    ".join(__A				)


       def 	_snake_case				(    self						,       __A				)						->    None:
              SCREAMING_SNAKE_CASE_							:				Dict		=self.rear.prev

              # All nodes other than self.head are guaranteed to have non-None previous
              assert previous is not None

              SCREAMING_SNAKE_CASE_							:				Any		=node
              SCREAMING_SNAKE_CASE_							:				Optional[int]		=previous
              SCREAMING_SNAKE_CASE_							:				Optional[Any]		=node
              SCREAMING_SNAKE_CASE_							:				Any		=self.rear





       def 	_snake_case				(    self						,       __A				)						->    DoubleLinkedListNode[T, U] | None:

              if node.prev is None or node.next is None:
                     return None

              SCREAMING_SNAKE_CASE_							:				Tuple		=node.next
              SCREAMING_SNAKE_CASE_							:				Optional[int]		=node.prev
              SCREAMING_SNAKE_CASE_							:				int		=None
              SCREAMING_SNAKE_CASE_							:				Dict		=None
              return node






class 			lowercase_		(      Generic[T, U]       ):
       __lowerCamelCase				       =						{}


       def __init__(    self						,       __A				)						->    Union[str, Any]:
              SCREAMING_SNAKE_CASE_							:				DoubleLinkedList[T, U]		=DoubleLinkedList()
              SCREAMING_SNAKE_CASE_							:				Tuple		=capacity
              SCREAMING_SNAKE_CASE_							:				Optional[int]		=0
              SCREAMING_SNAKE_CASE_							:				int		=0
              SCREAMING_SNAKE_CASE_							:				Optional[int]		=0
              SCREAMING_SNAKE_CASE_							:				dict[T, DoubleLinkedListNode[T, U]]		={}


       def __repr__(    self				)						->    str:
              return (
                  F'CacheInfo(hits={self.hits}, misses={self.miss}, '
                  F'capacity={self.capacity}, current size={self.num_keys})'
              )


       def __contains__(    self						,       __A				)						->    bool:
              return key in self.cache


       def 	_snake_case				(    self						,       __A				)						->    U | None:
              # Note: pythonic interface would throw KeyError rather than return None

              if key in self.cache:
                     self.hits += 1
                     SCREAMING_SNAKE_CASE_							:				DoubleLinkedListNode[T, U]		=self.cache[key]
                     SCREAMING_SNAKE_CASE_							:				Optional[int]		=self.list.remove(self.cache[key]				)
                     assert node == value_node

                     # node is guaranteed not None because it is in self.cache
                     assert node is not None
                     self.list.add(__A				)
                     return node.val
              self.miss += 1
              return None


       def 	_snake_case				(    self						,       __A						,       __A				)						->    None:

              if key not in self.cache:
                     if self.num_keys >= self.capacity:
                            # delete first node (oldest) when over capacity
                            SCREAMING_SNAKE_CASE_							:				List[str]		=self.list.head.next

                            # guaranteed to have a non-None first node when num_keys > 0
                            # explain to type checker via assertions
                            assert first_node is not None
                            assert first_node.key is not None
                            assert (
                                self.list.remove(__A				) is not None
                            )  # node guaranteed to be in list assert node.key is not None

                            del self.cache[first_node.key]
                            self.num_keys -= 1
                     SCREAMING_SNAKE_CASE_							:				Union[str, Any]		=DoubleLinkedListNode(__A						,       __A				)
                     self.list.add(self.cache[key]				)
                     self.num_keys += 1

              else:
                     # bump node to the end of the list, update value
                     SCREAMING_SNAKE_CASE_							:				str		=self.list.remove(self.cache[key]				)
                     assert node is not None  # node guaranteed to be in list
                     SCREAMING_SNAKE_CASE_							:				List[str]		=value
                     self.list.add(__A				)





       @classmethod
       def 	_snake_case				(    cls						,       __A = 128				)						->    Callable[[Callable[[T], U]], Callable[..., U]]:

              def cache_decorator_inner(__A				) -> Callable[..., U]:
                     def cache_decorator_wrapper(*__A				) -> U:
                            if func not in cls.decorator_function_to_instance_map:
                                   SCREAMING_SNAKE_CASE_							:				int		=LRUCache(__A				)

                            SCREAMING_SNAKE_CASE_							:				Optional[int]		=cls.decorator_function_to_instance_map[func].get(args[0]				)
                            if result is None:
                                   SCREAMING_SNAKE_CASE_							:				str		=func(*__A				)
                                   cls.decorator_function_to_instance_map[func].put(args[0]						,       __A				)
                            return result

                     def cache_info() -> LRUCache[T, U]:
                            return cls.decorator_function_to_instance_map[func]

                     setattr(__A						,       '''cache_info'''						,       __A				)  # noqa: B010

                     return cache_decorator_wrapper

              return cache_decorator_inner


if __name__ == "__main__":
 import doctest

 doctest.testmod()


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 YolosImageProcessor


class 			lowercase_		(      unittest.TestCase       ):


       def __init__(    self						,       __A						,       __A=7						,       __A=3						,       __A=30						,       __A=400						,       __A=True						,       __A=None						,       __A=True						,       __A=[0.5, 0.5, 0.5]						,       __A=[0.5, 0.5, 0.5]						,       __A=True						,       __A=1 / 255						,       __A=True						,       )						->    Tuple:
              # by setting size["longest_edge"] > max_resolution we're effectively not testing this :p
              SCREAMING_SNAKE_CASE_							:				Any		=size if size is not None else {'''shortest_edge''': 18, '''longest_edge''': 1_333}
              SCREAMING_SNAKE_CASE_							:				Dict		=parent
              SCREAMING_SNAKE_CASE_							:				Optional[Any]		=batch_size
              SCREAMING_SNAKE_CASE_							:				List[Any]		=num_channels
              SCREAMING_SNAKE_CASE_							:				Optional[int]		=min_resolution
              SCREAMING_SNAKE_CASE_							:				str		=max_resolution
              SCREAMING_SNAKE_CASE_							:				int		=do_resize
              SCREAMING_SNAKE_CASE_							:				Optional[int]		=size
              SCREAMING_SNAKE_CASE_							:				str		=do_normalize
              SCREAMING_SNAKE_CASE_							:				Optional[int]		=image_mean
              SCREAMING_SNAKE_CASE_							:				Any		=image_std
              SCREAMING_SNAKE_CASE_							:				Optional[int]		=do_rescale
              SCREAMING_SNAKE_CASE_							:				Union[str, Any]		=rescale_factor
              SCREAMING_SNAKE_CASE_							:				str		=do_pad


       def 	_snake_case				(    self				)						->    int:
              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 	_snake_case				(    self						,       __A						,       __A=False				)						->    Any:
              if not batched:
                     SCREAMING_SNAKE_CASE_							:				str		=image_inputs[0]
                     if isinstance(__A						,       Image.Image				):
                            SCREAMING_SNAKE_CASE_	,     SCREAMING_SNAKE_CASE_							:				Optional[Any]		=image.size
                     else:
                            SCREAMING_SNAKE_CASE_	,     SCREAMING_SNAKE_CASE_							:				str		=image.shape[1], image.shape[2]
                     if w < h:
                            SCREAMING_SNAKE_CASE_							:				List[Any]		=int(self.size['''shortest_edge'''] * h / w				)
                            SCREAMING_SNAKE_CASE_							:				Optional[int]		=self.size['''shortest_edge''']
                     elif w > h:
                            SCREAMING_SNAKE_CASE_							:				List[Any]		=self.size['''shortest_edge''']
                            SCREAMING_SNAKE_CASE_							:				Dict		=int(self.size['''shortest_edge'''] * w / h				)
                     else:
                            SCREAMING_SNAKE_CASE_							:				str		=self.size['''shortest_edge''']
                            SCREAMING_SNAKE_CASE_							:				str		=self.size['''shortest_edge''']

              else:
                     SCREAMING_SNAKE_CASE_							:				Any		=[]
                     for image in image_inputs:
                            SCREAMING_SNAKE_CASE_	,     SCREAMING_SNAKE_CASE_							:				str		=self.get_expected_values([image]				)
                            expected_values.append((expected_height, expected_width)				)
                     SCREAMING_SNAKE_CASE_							:				str		=max(__A						,       key=lambda __A				: item[0]				)[0]
                     SCREAMING_SNAKE_CASE_							:				List[Any]		=max(__A						,       key=lambda __A				: item[1]				)[1]

              return expected_height, expected_width






@require_torch
@require_vision
class 			lowercase_		(      A  ,      unittest.TestCase       ):
       __lowerCamelCase				       =						YolosImageProcessor if is_vision_available() else None


       def 	_snake_case				(    self				)						->    Dict:
              SCREAMING_SNAKE_CASE_							:				str		=YolosImageProcessingTester(self				)


       @property
       def 	_snake_case				(    self				)						->    Dict:
              return self.image_processor_tester.prepare_image_processor_dict()


       def 	_snake_case				(    self				)						->    Optional[Any]:
              SCREAMING_SNAKE_CASE_							:				Union[str, Any]		=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						,       '''size'''				)				)


       def 	_snake_case				(    self				)						->    List[Any]:
              SCREAMING_SNAKE_CASE_							:				str		=self.image_processing_class.from_dict(self.image_processor_dict				)
              self.assertEqual(image_processor.size						,       {'''shortest_edge''': 18, '''longest_edge''': 1_333}				)
              self.assertEqual(image_processor.do_pad						,       __A				)

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


       def 	_snake_case				(    self				)						->    List[str]:
              pass


       def 	_snake_case				(    self				)						->    int:
              # Initialize image_processing
              SCREAMING_SNAKE_CASE_							:				str		=self.image_processing_class(**self.image_processor_dict				)
              # create random PIL images
              SCREAMING_SNAKE_CASE_							:				Union[str, Any]		=prepare_image_inputs(self.image_processor_tester						,       equal_resolution=__A				)
              for image in image_inputs:
                     self.assertIsInstance(__A						,       Image.Image				)

              # Test not batched input
              SCREAMING_SNAKE_CASE_							:				List[str]		=image_processing(image_inputs[0]						,       return_tensors='''pt'''				).pixel_values

              SCREAMING_SNAKE_CASE_	,     SCREAMING_SNAKE_CASE_							:				List[Any]		=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
              SCREAMING_SNAKE_CASE_	,     SCREAMING_SNAKE_CASE_							:				List[str]		=self.image_processor_tester.get_expected_values(__A						,       batched=__A				)

              SCREAMING_SNAKE_CASE_							:				str		=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 	_snake_case				(    self				)						->    Optional[Any]:
              # Initialize image_processing
              SCREAMING_SNAKE_CASE_							:				Tuple		=self.image_processing_class(**self.image_processor_dict				)
              # create random numpy tensors
              SCREAMING_SNAKE_CASE_							:				Union[str, Any]		=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
              SCREAMING_SNAKE_CASE_							:				Dict		=image_processing(image_inputs[0]						,       return_tensors='''pt'''				).pixel_values

              SCREAMING_SNAKE_CASE_	,     SCREAMING_SNAKE_CASE_							:				List[Any]		=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
              SCREAMING_SNAKE_CASE_							:				Dict		=image_processing(__A						,       return_tensors='''pt'''				).pixel_values

              SCREAMING_SNAKE_CASE_	,     SCREAMING_SNAKE_CASE_							:				List[Any]		=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 	_snake_case				(    self				)						->    Dict:
              # Initialize image_processing
              SCREAMING_SNAKE_CASE_							:				str		=self.image_processing_class(**self.image_processor_dict				)
              # create random PyTorch tensors
              SCREAMING_SNAKE_CASE_							:				Dict		=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
              SCREAMING_SNAKE_CASE_							:				Any		=image_processing(image_inputs[0]						,       return_tensors='''pt'''				).pixel_values

              SCREAMING_SNAKE_CASE_	,     SCREAMING_SNAKE_CASE_							:				Union[str, Any]		=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
              SCREAMING_SNAKE_CASE_							:				str		=image_processing(__A						,       return_tensors='''pt'''				).pixel_values

              SCREAMING_SNAKE_CASE_	,     SCREAMING_SNAKE_CASE_							:				Optional[Any]		=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 	_snake_case				(    self				)						->    List[Any]:
              # Initialize image_processings
              SCREAMING_SNAKE_CASE_							:				List[str]		=self.image_processing_class(**self.image_processor_dict				)
              SCREAMING_SNAKE_CASE_							:				str		=self.image_processing_class(do_resize=__A						,       do_normalize=__A						,       do_rescale=__A				)
              # create random PyTorch tensors
              SCREAMING_SNAKE_CASE_							:				Dict		=prepare_image_inputs(self.image_processor_tester						,       equal_resolution=__A						,       torchify=__A				)
              for image in image_inputs:
                     self.assertIsInstance(__A						,       torch.Tensor				)

              # Test whether the method "pad" and calling the image processor return the same tensors
              SCREAMING_SNAKE_CASE_							:				List[Any]		=image_processing_a.pad(__A						,       return_tensors='''pt'''				)
              SCREAMING_SNAKE_CASE_							:				Union[str, Any]		=image_processing_a(__A						,       return_tensors='''pt'''				)

              self.assertTrue(
                  torch.allclose(encoded_images_with_method['''pixel_values''']						,       encoded_images['''pixel_values''']						,       atol=1e-4				)				)


       @slow
       def 	_snake_case				(    self				)						->    Any:
              # prepare image and target
              SCREAMING_SNAKE_CASE_							:				Dict		=Image.open('''./tests/fixtures/tests_samples/COCO/000000039769.png'''				)
              with open('''./tests/fixtures/tests_samples/COCO/coco_annotations.txt'''						,       '''r'''				) as f:
                     SCREAMING_SNAKE_CASE_							:				Optional[Any]		=json.loads(f.read()				)

              SCREAMING_SNAKE_CASE_							:				Dict		={'''image_id''': 39_769, '''annotations''': target}

              # encode them
              SCREAMING_SNAKE_CASE_							:				Union[str, Any]		=YolosImageProcessor.from_pretrained('''hustvl/yolos-small'''				)
              SCREAMING_SNAKE_CASE_							:				Dict		=image_processing(images=__A						,       annotations=__A						,       return_tensors='''pt'''				)

              # verify pixel values
              SCREAMING_SNAKE_CASE_							:				Dict		=torch.Size([1, 3, 800, 1_066]				)
              self.assertEqual(encoding['''pixel_values'''].shape						,       __A				)

              SCREAMING_SNAKE_CASE_							:				Union[str, Any]		=torch.tensor([0.2_796, 0.3_138, 0.3_481]				)
              self.assertTrue(torch.allclose(encoding['''pixel_values'''][0, 0, 0, :3]						,       __A						,       atol=1e-4				)				)

              # verify area
              SCREAMING_SNAKE_CASE_							:				Tuple		=torch.tensor([5_887.9_600, 11_250.2_061, 489_353.8_438, 837_122.7_500, 147_967.5_156, 165_732.3_438]				)
              self.assertTrue(torch.allclose(encoding['''labels'''][0]['''area''']						,       __A				)				)
              # verify boxes
              SCREAMING_SNAKE_CASE_							:				Dict		=torch.Size([6, 4]				)
              self.assertEqual(encoding['''labels'''][0]['''boxes'''].shape						,       __A				)
              SCREAMING_SNAKE_CASE_							:				Optional[Any]		=torch.tensor([0.5_503, 0.2_765, 0.0_604, 0.2_215]				)
              self.assertTrue(torch.allclose(encoding['''labels'''][0]['''boxes'''][0]						,       __A						,       atol=1e-3				)				)
              # verify image_id
              SCREAMING_SNAKE_CASE_							:				Union[str, Any]		=torch.tensor([39_769]				)
              self.assertTrue(torch.allclose(encoding['''labels'''][0]['''image_id''']						,       __A				)				)
              # verify is_crowd
              SCREAMING_SNAKE_CASE_							:				Optional[int]		=torch.tensor([0, 0, 0, 0, 0, 0]				)
              self.assertTrue(torch.allclose(encoding['''labels'''][0]['''iscrowd''']						,       __A				)				)
              # verify class_labels
              SCREAMING_SNAKE_CASE_							:				str		=torch.tensor([75, 75, 63, 65, 17, 17]				)
              self.assertTrue(torch.allclose(encoding['''labels'''][0]['''class_labels''']						,       __A				)				)
              # verify orig_size
              SCREAMING_SNAKE_CASE_							:				str		=torch.tensor([480, 640]				)
              self.assertTrue(torch.allclose(encoding['''labels'''][0]['''orig_size''']						,       __A				)				)
              # verify size
              SCREAMING_SNAKE_CASE_							:				Dict		=torch.tensor([800, 1_066]				)
              self.assertTrue(torch.allclose(encoding['''labels'''][0]['''size''']						,       __A				)				)





       @slow
       def 	_snake_case				(    self				)						->    Tuple:
              # prepare image, target and masks_path
              SCREAMING_SNAKE_CASE_							:				Union[str, Any]		=Image.open('''./tests/fixtures/tests_samples/COCO/000000039769.png'''				)
              with open('''./tests/fixtures/tests_samples/COCO/coco_panoptic_annotations.txt'''						,       '''r'''				) as f:
                     SCREAMING_SNAKE_CASE_							:				Optional[Any]		=json.loads(f.read()				)

              SCREAMING_SNAKE_CASE_							:				Union[str, Any]		={'''file_name''': '''000000039769.png''', '''image_id''': 39_769, '''segments_info''': target}

              SCREAMING_SNAKE_CASE_							:				Tuple		=pathlib.Path('''./tests/fixtures/tests_samples/COCO/coco_panoptic'''				)

              # encode them
              SCREAMING_SNAKE_CASE_							:				Optional[Any]		=YolosImageProcessor(format='''coco_panoptic'''				)
              SCREAMING_SNAKE_CASE_							:				Optional[int]		=image_processing(images=__A						,       annotations=__A						,       masks_path=__A						,       return_tensors='''pt'''				)

              # verify pixel values
              SCREAMING_SNAKE_CASE_							:				Optional[int]		=torch.Size([1, 3, 800, 1_066]				)
              self.assertEqual(encoding['''pixel_values'''].shape						,       __A				)

              SCREAMING_SNAKE_CASE_							:				Optional[Any]		=torch.tensor([0.2_796, 0.3_138, 0.3_481]				)
              self.assertTrue(torch.allclose(encoding['''pixel_values'''][0, 0, 0, :3]						,       __A						,       atol=1e-4				)				)

              # verify area
              SCREAMING_SNAKE_CASE_							:				List[Any]		=torch.tensor([147_979.6_875, 165_527.0_469, 484_638.5_938, 11_292.9_375, 5_879.6_562, 7_634.1_147]				)
              self.assertTrue(torch.allclose(encoding['''labels'''][0]['''area''']						,       __A				)				)
              # verify boxes
              SCREAMING_SNAKE_CASE_							:				Tuple		=torch.Size([6, 4]				)
              self.assertEqual(encoding['''labels'''][0]['''boxes'''].shape						,       __A				)
              SCREAMING_SNAKE_CASE_							:				List[Any]		=torch.tensor([0.2_625, 0.5_437, 0.4_688, 0.8_625]				)
              self.assertTrue(torch.allclose(encoding['''labels'''][0]['''boxes'''][0]						,       __A						,       atol=1e-3				)				)
              # verify image_id
              SCREAMING_SNAKE_CASE_							:				Any		=torch.tensor([39_769]				)
              self.assertTrue(torch.allclose(encoding['''labels'''][0]['''image_id''']						,       __A				)				)
              # verify is_crowd
              SCREAMING_SNAKE_CASE_							:				Tuple		=torch.tensor([0, 0, 0, 0, 0, 0]				)
              self.assertTrue(torch.allclose(encoding['''labels'''][0]['''iscrowd''']						,       __A				)				)
              # verify class_labels
              SCREAMING_SNAKE_CASE_							:				Optional[Any]		=torch.tensor([17, 17, 63, 75, 75, 93]				)
              self.assertTrue(torch.allclose(encoding['''labels'''][0]['''class_labels''']						,       __A				)				)
              # verify masks
              SCREAMING_SNAKE_CASE_							:				List[Any]		=822_873
              self.assertEqual(encoding['''labels'''][0]['''masks'''].sum().item()						,       __A				)
              # verify orig_size
              SCREAMING_SNAKE_CASE_							:				List[str]		=torch.tensor([480, 640]				)
              self.assertTrue(torch.allclose(encoding['''labels'''][0]['''orig_size''']						,       __A				)				)
              # verify size
              SCREAMING_SNAKE_CASE_							:				Any		=torch.tensor([800, 1_066]				)
              self.assertTrue(torch.allclose(encoding['''labels'''][0]['''size''']						,       __A				)				)
