


'''simple docstring'''

import gc
import math
import unittest

import torch

from diffusers import UNetaDModel
from diffusers.utils import floats_tensor, logging, slow, torch_all_close, torch_device
from diffusers.utils.testing_utils import enable_full_determinism

from .test_modeling_common import ModelTesterMixin, UNetTesterMixin


lowerCamelCase				:  int    		=      logging.get_logger(__name__)

enable_full_determinism()
class     __lowerCAmelCase		(lowercase_    ,	lowercase_    ,	unittest.TestCase	):





      '''simple docstring'''






      lowerCAmelCase__   :	List[str]       =				UNetaDModel
      lowerCAmelCase__   :	List[str]       =				"""sample"""



      @property
      def  UpperCamelCase__						(self       :       Union[str, Any]					):

             '''simple docstring'''







             lowercase__      =					4
             lowercase__      =					3
             lowercase__      =					(32, 32)

             lowercase__      =					floats_tensor((batch_size, num_channels) + sizes					).to(UpperCamelCase					)
             lowercase__      =					torch.tensor([10]					).to(UpperCamelCase					)

             return {"sample": noise, "timestep": time_step}



      @property
      def  UpperCamelCase__						(self       :       Any					):

             '''simple docstring'''







             return (3, 32, 32)



      @property
      def  UpperCamelCase__						(self       :       Optional[Any]					):

             '''simple docstring'''







             return (3, 32, 32)






      def  UpperCamelCase__						(self       :       Dict					):

             '''simple docstring'''







             lowercase__      =					{
                 '''block_out_channels''': (32, 64),
                 '''down_block_types''': ('''DownBlock2D''', '''AttnDownBlock2D'''),
                 '''up_block_types''': ('''AttnUpBlock2D''', '''UpBlock2D'''),
                 '''attention_head_dim''': 3,
                 '''out_channels''': 3,
                 '''in_channels''': 3,
                 '''layers_per_block''': 2,
                 '''sample_size''': 32,
             }
             lowercase__      =					self.dummy_input
             return init_dict, inputs_dict






class     __lowerCAmelCase		(lowercase_    ,	lowercase_    ,	unittest.TestCase	):





      '''simple docstring'''






      lowerCAmelCase__   :	Union[str, Any]       =				UNetaDModel
      lowerCAmelCase__   :	Optional[Any]       =				"""sample"""



      @property
      def  UpperCamelCase__						(self       :       Tuple					):

             '''simple docstring'''







             lowercase__      =					4
             lowercase__      =					4
             lowercase__      =					(32, 32)

             lowercase__      =					floats_tensor((batch_size, num_channels) + sizes					).to(UpperCamelCase					)
             lowercase__      =					torch.tensor([10]					).to(UpperCamelCase					)

             return {"sample": noise, "timestep": time_step}



      @property
      def  UpperCamelCase__						(self       :       List[str]					):

             '''simple docstring'''







             return (4, 32, 32)



      @property
      def  UpperCamelCase__						(self       :       List[str]					):

             '''simple docstring'''







             return (4, 32, 32)



      def  UpperCamelCase__						(self       :       Dict					):

             '''simple docstring'''







             lowercase__      =					{
                 '''sample_size''': 32,
                 '''in_channels''': 4,
                 '''out_channels''': 4,
                 '''layers_per_block''': 2,
                 '''block_out_channels''': (32, 64),
                 '''attention_head_dim''': 32,
                 '''down_block_types''': ('''DownBlock2D''', '''DownBlock2D'''),
                 '''up_block_types''': ('''UpBlock2D''', '''UpBlock2D'''),
             }
             lowercase__      =					self.dummy_input
             return init_dict, inputs_dict



      def  UpperCamelCase__						(self       :       Tuple					):

             '''simple docstring'''







             lowercase__     ,lowercase__      =					UNetaDModel.from_pretrained('''fusing/unet-ldm-dummy-update'''  ,		output_loading_info=UpperCamelCase					)

             self.assertIsNotNone(UpperCamelCase					)
             self.assertEqual(len(loading_info['''missing_keys''']					)  ,		0					)

             model.to(UpperCamelCase					)
             lowercase__      =					model(**self.dummy_input					).sample

             assert image is not None, "Make sure output is not None"



      @unittest.skipIf(torch_device != '''cuda'''  ,		'''This test is supposed to run on GPU'''					)
      def  UpperCamelCase__						(self       :       Union[str, Any]					):

             '''simple docstring'''







             lowercase__     ,lowercase__      =					UNetaDModel.from_pretrained('''fusing/unet-ldm-dummy-update'''  ,		output_loading_info=UpperCamelCase					)
             model.to(UpperCamelCase					)
             lowercase__      =					model(**self.dummy_input					).sample

             assert image is not None, "Make sure output is not None"



      @unittest.skipIf(torch_device != '''cuda'''  ,		'''This test is supposed to run on GPU'''					)
      def  UpperCamelCase__						(self       :       Tuple					):

             '''simple docstring'''







             lowercase__     ,lowercase__      =					UNetaDModel.from_pretrained('''fusing/unet-ldm-dummy-update'''  ,		output_loading_info=UpperCamelCase					)
             model_accelerate.to(UpperCamelCase					)
             model_accelerate.eval()

             lowercase__      =					torch.randn(
                 1  ,		model_accelerate.config.in_channels  ,		model_accelerate.config.sample_size  ,		model_accelerate.config.sample_size  ,		generator=torch.manual_seed(0					)  ,		)
             lowercase__      =					noise.to(UpperCamelCase					)
             lowercase__      =					torch.tensor([10] * noise.shape[0]					).to(UpperCamelCase					)

             lowercase__      =					model_accelerate(UpperCamelCase  ,		UpperCamelCase					)['''sample''']

             # two models don't need to stay in the device at the same time
             del model_accelerate
             torch.cuda.empty_cache()
             gc.collect()

             lowercase__     ,lowercase__      =					UNetaDModel.from_pretrained(
                 '''fusing/unet-ldm-dummy-update'''  ,		output_loading_info=UpperCamelCase  ,		low_cpu_mem_usage=UpperCamelCase					)
             model_normal_load.to(UpperCamelCase					)
             model_normal_load.eval()
             lowercase__      =					model_normal_load(UpperCamelCase  ,		UpperCamelCase					)['''sample''']

             assert torch_all_close(UpperCamelCase  ,		UpperCamelCase  ,		rtol=1E-3					)






      def  UpperCamelCase__						(self       :       List[Any]					):

             '''simple docstring'''







             lowercase__      =					UNetaDModel.from_pretrained('''fusing/unet-ldm-dummy-update'''					)
             model.eval()
             model.to(UpperCamelCase					)

             lowercase__      =					torch.randn(
                 1  ,		model.config.in_channels  ,		model.config.sample_size  ,		model.config.sample_size  ,		generator=torch.manual_seed(0					)  ,		)
             lowercase__      =					noise.to(UpperCamelCase					)
             lowercase__      =					torch.tensor([10] * noise.shape[0]					).to(UpperCamelCase					)

             with torch.no_grad():
                    lowercase__      =					model(UpperCamelCase  ,		UpperCamelCase					).sample

             lowercase__      =					output[0, -1, -3:, -3:].flatten().cpu()
             # fmt: off
             lowercase__      =					torch.tensor([-13.32_58, -20.11_00, -15.98_73, -17.66_17, -23.05_96, -17.94_19, -13.36_75, -16.18_89, -12.38_00]					)
             # fmt: on

             self.assertTrue(torch_all_close(UpperCamelCase  ,		UpperCamelCase  ,		rtol=1E-3					)					)






class     __lowerCAmelCase		(lowercase_    ,	lowercase_    ,	unittest.TestCase	):





      '''simple docstring'''






      lowerCAmelCase__   :	List[str]       =				UNetaDModel
      lowerCAmelCase__   :	List[str]       =				"""sample"""



      @property
      def  UpperCamelCase__						(self       :       Dict  ,		UpperCamelCase       :       List[str]=(32, 32)					):

             '''simple docstring'''







             lowercase__      =					4
             lowercase__      =					3

             lowercase__      =					floats_tensor((batch_size, num_channels) + sizes					).to(UpperCamelCase					)
             lowercase__      =					torch.tensor(batch_size * [10]					).to(dtype=torch.intaa  ,		device=UpperCamelCase					)

             return {"sample": noise, "timestep": time_step}



      @property
      def  UpperCamelCase__						(self       :       Dict					):

             '''simple docstring'''







             return (3, 32, 32)



      @property
      def  UpperCamelCase__						(self       :       Dict					):

             '''simple docstring'''







             return (3, 32, 32)



      def  UpperCamelCase__						(self       :       Union[str, Any]					):

             '''simple docstring'''







             lowercase__      =					{
                 '''block_out_channels''': [32, 64, 64, 64],
                 '''in_channels''': 3,
                 '''layers_per_block''': 1,
                 '''out_channels''': 3,
                 '''time_embedding_type''': '''fourier''',
                 '''norm_eps''': 1E-6,
                 '''mid_block_scale_factor''': math.sqrt(2.0					),
                 '''norm_num_groups''': None,
                 '''down_block_types''': [
                     '''SkipDownBlock2D''',
                     '''AttnSkipDownBlock2D''',
                     '''SkipDownBlock2D''',
                     '''SkipDownBlock2D''',
                 ],
                 '''up_block_types''': [
                     '''SkipUpBlock2D''',
                     '''SkipUpBlock2D''',
                     '''AttnSkipUpBlock2D''',
                     '''SkipUpBlock2D''',
                 ],
             }
             lowercase__      =					self.dummy_input
             return init_dict, inputs_dict



      @slow
      def  UpperCamelCase__						(self       :       str					):

             '''simple docstring'''







             lowercase__     ,lowercase__      =					UNetaDModel.from_pretrained('''google/ncsnpp-celebahq-256'''  ,		output_loading_info=UpperCamelCase					)
             self.assertIsNotNone(UpperCamelCase					)
             self.assertEqual(len(loading_info['''missing_keys''']					)  ,		0					)

             model.to(UpperCamelCase					)
             lowercase__      =					self.dummy_input
             lowercase__      =					floats_tensor((4, 3) + (256, 256)					).to(UpperCamelCase					)
             lowercase__      =					noise
             lowercase__      =					model(**UpperCamelCase					)

             assert image is not None, "Make sure output is not None"



      @slow
      def  UpperCamelCase__						(self       :       int					):

             '''simple docstring'''







             lowercase__      =					UNetaDModel.from_pretrained('''google/ncsnpp-celebahq-256'''					)
             model.to(UpperCamelCase					)

             lowercase__      =					4
             lowercase__      =					3
             lowercase__      =					(256, 256)

             lowercase__      =					torch.ones((batch_size, num_channels) + sizes					).to(UpperCamelCase					)
             lowercase__      =					torch.tensor(batch_size * [1E-4]					).to(UpperCamelCase					)

             with torch.no_grad():
                    lowercase__      =					model(UpperCamelCase  ,		UpperCamelCase					).sample

             lowercase__      =					output[0, -3:, -3:, -1].flatten().cpu()
             # fmt: off
             lowercase__      =					torch.tensor([-48_42.86_91, -64_99.66_31, -38_00.19_53, -79_78.26_86, -1_09_80.71_29, -2_00_28.85_35, 81_48.28_22, 23_42.29_05, 5_67.76_08]					)
             # fmt: on

             self.assertTrue(torch_all_close(UpperCamelCase  ,		UpperCamelCase  ,		rtol=1E-2					)					)



      def  UpperCamelCase__						(self       :       str					):

             '''simple docstring'''







             lowercase__      =					UNetaDModel.from_pretrained('''fusing/ncsnpp-ffhq-ve-dummy-update'''					)
             model.to(UpperCamelCase					)

             lowercase__      =					4
             lowercase__      =					3
             lowercase__      =					(32, 32)

             lowercase__      =					torch.ones((batch_size, num_channels) + sizes					).to(UpperCamelCase					)
             lowercase__      =					torch.tensor(batch_size * [1E-4]					).to(UpperCamelCase					)

             with torch.no_grad():
                    lowercase__      =					model(UpperCamelCase  ,		UpperCamelCase					).sample

             lowercase__      =					output[0, -3:, -3:, -1].flatten().cpu()
             # fmt: off
             lowercase__      =					torch.tensor([-0.03_25, -0.09_00, -0.08_69, -0.03_32, -0.07_25, -0.02_70, -0.01_01, 0.02_27, 0.02_56]					)
             # fmt: on

             self.assertTrue(torch_all_close(UpperCamelCase  ,		UpperCamelCase  ,		rtol=1E-2					)					)






      def  UpperCamelCase__						(self       :       int					):

             '''simple docstring'''







             pass








'''simple docstring'''

import unittest

from transformers import MODEL_FOR_ZERO_SHOT_OBJECT_DETECTION_MAPPING, is_vision_available, pipeline
from transformers.testing_utils import (
    is_pipeline_test,
    nested_simplify,
    require_tf,
    require_torch,
    require_vision,
    slow,
)

from .test_pipelines_common import ANY


if is_vision_available():
 from PIL import Image
else:
 class     __lowerCAmelCase		:





       '''simple docstring'''






       @staticmethod
       def  UpperCamelCase__						(*UpperCamelCase       :       Optional[Any]  ,		**UpperCamelCase       :       Tuple					):

              '''simple docstring'''







              pass
@is_pipeline_test
@require_vision
@require_torch
class     __lowerCAmelCase		(unittest.TestCase	):





      '''simple docstring'''






      lowerCAmelCase__   :	Optional[int]       =				MODEL_FOR_ZERO_SHOT_OBJECT_DETECTION_MAPPING



      def  UpperCamelCase__						(self       :       int  ,		UpperCamelCase       :       List[str]  ,		UpperCamelCase       :       List[str]  ,		UpperCamelCase       :       str					):

             '''simple docstring'''







             lowercase__      =					pipeline(
                 '''zero-shot-object-detection'''  ,		model='''hf-internal-testing/tiny-random-owlvit-object-detection'''					)

             lowercase__      =					[
                 {
                     '''image''': '''./tests/fixtures/tests_samples/COCO/000000039769.png''',
                     '''candidate_labels''': ['''cat''', '''remote''', '''couch'''],
                 }
             ]
             return object_detector, examples



      def  UpperCamelCase__						(self       :       Optional[Any]  ,		UpperCamelCase       :       Tuple  ,		UpperCamelCase       :       Optional[int]					):

             '''simple docstring'''







             lowercase__      =					object_detector(examples[0]  ,		threshold=0.0					)

             lowercase__      =					len(UpperCamelCase					)
             self.assertGreater(UpperCamelCase  ,		0					)
             self.assertEqual(
                 UpperCamelCase  ,		[
                     {
                         '''score''': ANY(UpperCamelCase					),
                         '''label''': ANY(UpperCamelCase					),
                         '''box''': {'''xmin''': ANY(UpperCamelCase					), '''ymin''': ANY(UpperCamelCase					), '''xmax''': ANY(UpperCamelCase					), '''ymax''': ANY(UpperCamelCase					)},
                     }
                     for i in range(UpperCamelCase					)
                 ]  ,		)



      @require_tf
      @unittest.skip('''Zero Shot Object Detection not implemented in TF'''					)
      def  UpperCamelCase__						(self       :       str					):

             '''simple docstring'''







             pass



      @require_torch
      def  UpperCamelCase__						(self       :       Any					):

             '''simple docstring'''







             lowercase__      =					pipeline(
                 '''zero-shot-object-detection'''  ,		model='''hf-internal-testing/tiny-random-owlvit-object-detection'''					)

             lowercase__      =					object_detector(
                 '''./tests/fixtures/tests_samples/COCO/000000039769.png'''  ,		candidate_labels=['''cat''', '''remote''', '''couch''']  ,		threshold=0.64  ,		)

             self.assertEqual(
                 nested_simplify(UpperCamelCase  ,		decimals=4					)  ,		[
                     {'''score''': 0.72_35, '''label''': '''cat''', '''box''': {'''xmin''': 204, '''ymin''': 167, '''xmax''': 232, '''ymax''': 190}},
                     {'''score''': 0.72_18, '''label''': '''remote''', '''box''': {'''xmin''': 204, '''ymin''': 167, '''xmax''': 232, '''ymax''': 190}},
                     {'''score''': 0.71_84, '''label''': '''couch''', '''box''': {'''xmin''': 204, '''ymin''': 167, '''xmax''': 232, '''ymax''': 190}},
                     {'''score''': 0.67_48, '''label''': '''remote''', '''box''': {'''xmin''': 571, '''ymin''': 83, '''xmax''': 598, '''ymax''': 103}},
                     {'''score''': 0.66_56, '''label''': '''cat''', '''box''': {'''xmin''': 571, '''ymin''': 83, '''xmax''': 598, '''ymax''': 103}},
                     {'''score''': 0.66_14, '''label''': '''couch''', '''box''': {'''xmin''': 571, '''ymin''': 83, '''xmax''': 598, '''ymax''': 103}},
                     {'''score''': 0.64_56, '''label''': '''remote''', '''box''': {'''xmin''': 494, '''ymin''': 105, '''xmax''': 521, '''ymax''': 127}},
                     {'''score''': 0.6_42, '''label''': '''remote''', '''box''': {'''xmin''': 67, '''ymin''': 274, '''xmax''': 93, '''ymax''': 297}},
                     {'''score''': 0.64_19, '''label''': '''cat''', '''box''': {'''xmin''': 494, '''ymin''': 105, '''xmax''': 521, '''ymax''': 127}},
                 ]  ,		)

             lowercase__      =					object_detector(
                 [
                     {
                         '''image''': '''./tests/fixtures/tests_samples/COCO/000000039769.png''',
                         '''candidate_labels''': ['''cat''', '''remote''', '''couch'''],
                     }
                 ]  ,		threshold=0.64  ,		)

             self.assertEqual(
                 nested_simplify(UpperCamelCase  ,		decimals=4					)  ,		[
                     [
                         {'''score''': 0.72_35, '''label''': '''cat''', '''box''': {'''xmin''': 204, '''ymin''': 167, '''xmax''': 232, '''ymax''': 190}},
                         {'''score''': 0.72_18, '''label''': '''remote''', '''box''': {'''xmin''': 204, '''ymin''': 167, '''xmax''': 232, '''ymax''': 190}},
                         {'''score''': 0.71_84, '''label''': '''couch''', '''box''': {'''xmin''': 204, '''ymin''': 167, '''xmax''': 232, '''ymax''': 190}},
                         {'''score''': 0.67_48, '''label''': '''remote''', '''box''': {'''xmin''': 571, '''ymin''': 83, '''xmax''': 598, '''ymax''': 103}},
                         {'''score''': 0.66_56, '''label''': '''cat''', '''box''': {'''xmin''': 571, '''ymin''': 83, '''xmax''': 598, '''ymax''': 103}},
                         {'''score''': 0.66_14, '''label''': '''couch''', '''box''': {'''xmin''': 571, '''ymin''': 83, '''xmax''': 598, '''ymax''': 103}},
                         {'''score''': 0.64_56, '''label''': '''remote''', '''box''': {'''xmin''': 494, '''ymin''': 105, '''xmax''': 521, '''ymax''': 127}},
                         {'''score''': 0.6_42, '''label''': '''remote''', '''box''': {'''xmin''': 67, '''ymin''': 274, '''xmax''': 93, '''ymax''': 297}},
                         {'''score''': 0.64_19, '''label''': '''cat''', '''box''': {'''xmin''': 494, '''ymin''': 105, '''xmax''': 521, '''ymax''': 127}},
                     ]
                 ]  ,		)



      @require_torch
      @slow
      def  UpperCamelCase__						(self       :       str					):

             '''simple docstring'''







             lowercase__      =					pipeline('''zero-shot-object-detection'''					)

             lowercase__      =					object_detector(
                 '''http://images.cocodataset.org/val2017/000000039769.jpg'''  ,		candidate_labels=['''cat''', '''remote''', '''couch''']  ,		)
             self.assertEqual(
                 nested_simplify(UpperCamelCase  ,		decimals=4					)  ,		[
                     {'''score''': 0.28_68, '''label''': '''cat''', '''box''': {'''xmin''': 324, '''ymin''': 20, '''xmax''': 640, '''ymax''': 373}},
                     {'''score''': 0.2_77, '''label''': '''remote''', '''box''': {'''xmin''': 40, '''ymin''': 72, '''xmax''': 177, '''ymax''': 115}},
                     {'''score''': 0.25_37, '''label''': '''cat''', '''box''': {'''xmin''': 1, '''ymin''': 55, '''xmax''': 315, '''ymax''': 472}},
                     {'''score''': 0.14_74, '''label''': '''remote''', '''box''': {'''xmin''': 335, '''ymin''': 74, '''xmax''': 371, '''ymax''': 187}},
                     {'''score''': 0.12_08, '''label''': '''couch''', '''box''': {'''xmin''': 4, '''ymin''': 0, '''xmax''': 642, '''ymax''': 476}},
                 ]  ,		)

             lowercase__      =					object_detector(
                 [
                     {
                         '''image''': '''http://images.cocodataset.org/val2017/000000039769.jpg''',
                         '''candidate_labels''': ['''cat''', '''remote''', '''couch'''],
                     },
                     {
                         '''image''': '''http://images.cocodataset.org/val2017/000000039769.jpg''',
                         '''candidate_labels''': ['''cat''', '''remote''', '''couch'''],
                     },
                 ]  ,		)
             self.assertEqual(
                 nested_simplify(UpperCamelCase  ,		decimals=4					)  ,		[
                     [
                         {'''score''': 0.28_68, '''label''': '''cat''', '''box''': {'''xmin''': 324, '''ymin''': 20, '''xmax''': 640, '''ymax''': 373}},
                         {'''score''': 0.2_77, '''label''': '''remote''', '''box''': {'''xmin''': 40, '''ymin''': 72, '''xmax''': 177, '''ymax''': 115}},
                         {'''score''': 0.25_37, '''label''': '''cat''', '''box''': {'''xmin''': 1, '''ymin''': 55, '''xmax''': 315, '''ymax''': 472}},
                         {'''score''': 0.14_74, '''label''': '''remote''', '''box''': {'''xmin''': 335, '''ymin''': 74, '''xmax''': 371, '''ymax''': 187}},
                         {'''score''': 0.12_08, '''label''': '''couch''', '''box''': {'''xmin''': 4, '''ymin''': 0, '''xmax''': 642, '''ymax''': 476}},
                     ],
                     [
                         {'''score''': 0.28_68, '''label''': '''cat''', '''box''': {'''xmin''': 324, '''ymin''': 20, '''xmax''': 640, '''ymax''': 373}},
                         {'''score''': 0.2_77, '''label''': '''remote''', '''box''': {'''xmin''': 40, '''ymin''': 72, '''xmax''': 177, '''ymax''': 115}},
                         {'''score''': 0.25_37, '''label''': '''cat''', '''box''': {'''xmin''': 1, '''ymin''': 55, '''xmax''': 315, '''ymax''': 472}},
                         {'''score''': 0.14_74, '''label''': '''remote''', '''box''': {'''xmin''': 335, '''ymin''': 74, '''xmax''': 371, '''ymax''': 187}},
                         {'''score''': 0.12_08, '''label''': '''couch''', '''box''': {'''xmin''': 4, '''ymin''': 0, '''xmax''': 642, '''ymax''': 476}},
                     ],
                 ]  ,		)



      @require_tf
      @unittest.skip('''Zero Shot Object Detection not implemented in TF'''					)
      def  UpperCamelCase__						(self       :       int					):

             '''simple docstring'''







             pass



      @require_torch
      @slow
      def  UpperCamelCase__						(self       :       Tuple					):

             '''simple docstring'''







             lowercase__      =					0.2
             lowercase__      =					pipeline('''zero-shot-object-detection'''					)

             lowercase__      =					object_detector(
                 '''http://images.cocodataset.org/val2017/000000039769.jpg'''  ,		candidate_labels=['''cat''', '''remote''', '''couch''']  ,		threshold=UpperCamelCase  ,		)
             self.assertEqual(
                 nested_simplify(UpperCamelCase  ,		decimals=4					)  ,		[
                     {'''score''': 0.28_68, '''label''': '''cat''', '''box''': {'''xmin''': 324, '''ymin''': 20, '''xmax''': 640, '''ymax''': 373}},
                     {'''score''': 0.2_77, '''label''': '''remote''', '''box''': {'''xmin''': 40, '''ymin''': 72, '''xmax''': 177, '''ymax''': 115}},
                     {'''score''': 0.25_37, '''label''': '''cat''', '''box''': {'''xmin''': 1, '''ymin''': 55, '''xmax''': 315, '''ymax''': 472}},
                 ]  ,		)






      @require_torch
      @slow
      def  UpperCamelCase__						(self       :       Dict					):

             '''simple docstring'''







             lowercase__      =					2
             lowercase__      =					pipeline('''zero-shot-object-detection'''					)

             lowercase__      =					object_detector(
                 '''http://images.cocodataset.org/val2017/000000039769.jpg'''  ,		candidate_labels=['''cat''', '''remote''', '''couch''']  ,		top_k=UpperCamelCase  ,		)
             self.assertEqual(
                 nested_simplify(UpperCamelCase  ,		decimals=4					)  ,		[
                     {'''score''': 0.28_68, '''label''': '''cat''', '''box''': {'''xmin''': 324, '''ymin''': 20, '''xmax''': 640, '''ymax''': 373}},
                     {'''score''': 0.2_77, '''label''': '''remote''', '''box''': {'''xmin''': 40, '''ymin''': 72, '''xmax''': 177, '''ymax''': 115}},
                 ]  ,		)




