






'''simple docstring'''





import colorsys
import io

import cva
import matplotlib as mpl
import matplotlib.colors as mplc
import matplotlib.figure as mplfigure
import numpy as np
import torch
from matplotlib.backends.backend_agg import FigureCanvasAgg

from utils import img_tensorize


_UpperCamelCase		:		List[Any]								=			1_000


class 				snake_case__     :




					def __init__(       self       :						Any							,				_A       :						Union[str, Any]							,				_A       :						Dict=1.2							,				_A       :						List[Any]="g"							,				_A       :						List[Any]=0.5							,				_A       :						Optional[int]="-"							,				_A       :						List[Any]="test_out.jpg"							,				_A       :						Any=True							,				_A       :						List[Any]=False							,				_A       :						Union[str, Any]=None							,				_A       :						Optional[Any]=None							,				_A       :						Dict=0.7							,				)  ->    int:





								if isinstance(_UpperCamelCase							,				torch.Tensor     ):
											UpperCAmelCase_     :   Tuple       =   img.numpy().astype('''np.uint8'''     )
								if isinstance(_UpperCamelCase							,				_UpperCamelCase     ):
											UpperCAmelCase_     :   Dict       =   img_tensorize(_UpperCamelCase     )
								assert isinstance(_UpperCamelCase							,				np.ndarray     )

								UpperCAmelCase_  ,     UpperCAmelCase_     :   Optional[int]       =   img.shape[1], img.shape[0]
								UpperCAmelCase_     :   Any       =   mplfigure.Figure(frameon=_UpperCamelCase     )
								UpperCAmelCase_     :   Optional[Any]       =   fig.get_dpi()
								UpperCAmelCase_     :   int       =   (width * scale + 1e-2) / dpi
								UpperCAmelCase_     :   int       =   (height * scale + 1e-2) / dpi
								fig.set_size_inches(_UpperCamelCase							,				_UpperCamelCase     )
								UpperCAmelCase_     :   Any       =   fig.add_axes([0.0, 0.0, 1.0, 1.0]     )
								ax.axis('''off'''     )
								ax.set_xlim(0.0							,				_UpperCamelCase     )
								ax.set_ylim(_UpperCamelCase     )

								UpperCAmelCase_     :   Dict       =   saveas
								UpperCAmelCase_     :   str       =   rgb
								UpperCAmelCase_     :   Union[str, Any]       =   pynb
								UpperCAmelCase_     :   List[str]       =   img
								UpperCAmelCase_     :   Any       =   edgecolor
								UpperCAmelCase_     :   Optional[Any]       =   0.5
								UpperCAmelCase_     :   Union[str, Any]       =   linestyle
								UpperCAmelCase_     :   Dict       =   int(np.sqrt(min(_UpperCamelCase							,				_UpperCamelCase     )     ) * scale // 3     )
								UpperCAmelCase_     :   Union[str, Any]       =   width
								UpperCAmelCase_     :   List[Any]       =   height
								UpperCAmelCase_     :   int       =   scale
								UpperCAmelCase_     :   Tuple       =   fig
								UpperCAmelCase_     :   str       =   ax
								UpperCAmelCase_     :   List[str]       =   pad
								UpperCAmelCase_     :   List[str]       =   idaobj
								UpperCAmelCase_     :   int       =   idaattr
								UpperCAmelCase_     :   Tuple       =   FigureCanvasAgg(_UpperCamelCase     )




					def 						A     (       self       :						Dict							,				_A       :						Tuple							,				_A       :						Dict=None     )  ->    Union[str, Any]:





								if color is None:
											UpperCAmelCase_     :   int       =   self.edgecolor
								((UpperCAmelCase_)  ,     (UpperCAmelCase_)  ,     (UpperCAmelCase_)  ,     (UpperCAmelCase_))     :   Optional[Any]       =   box
								UpperCAmelCase_     :   str       =   xa - xa
								UpperCAmelCase_     :   List[str]       =   ya - ya
								self.ax.add_patch(
								    mpl.patches.Rectangle(
								        (xa, ya)							,				_UpperCamelCase							,				_UpperCamelCase							,				fill=_UpperCamelCase							,				edgecolor=_UpperCamelCase							,				linewidth=self.font_size // 3							,				alpha=self.alpha							,				linestyle=self.linestyle							,				)     )




					def 						A     (       self       :						Optional[int]							,				_A       :						Union[str, Any]							,				_A       :						List[str]=None							,				_A       :						List[Any]=None							,				_A       :						List[Any]=None							,				_A       :						List[Any]=None     )  ->    Dict:





								if len(boxes.shape     ) > 2:
											UpperCAmelCase_     :   int       =   boxes[0]
								if len(obj_ids.shape     ) > 1:
											UpperCAmelCase_     :   List[Any]       =   obj_ids[0]
								if len(obj_scores.shape     ) > 1:
											UpperCAmelCase_     :   str       =   obj_scores[0]
								if len(attr_ids.shape     ) > 1:
											UpperCAmelCase_     :   Optional[Any]       =   attr_ids[0]
								if len(attr_scores.shape     ) > 1:
											UpperCAmelCase_     :   str       =   attr_scores[0]
								if isinstance(_UpperCamelCase							,				torch.Tensor     ):
											UpperCAmelCase_     :   int       =   boxes.numpy()
								if isinstance(_UpperCamelCase							,				_UpperCamelCase     ):
											UpperCAmelCase_     :   str       =   np.array(_UpperCamelCase     )
								assert isinstance(_UpperCamelCase							,				np.ndarray     )
								UpperCAmelCase_     :   int       =   np.prod(boxes[:, 2:] - boxes[:, :2]							,				axis=1     )
								UpperCAmelCase_     :   List[str]       =   np.argsort(-areas     ).tolist()
								UpperCAmelCase_     :   List[str]       =   boxes[sorted_idxs] if boxes is not None else None
								UpperCAmelCase_     :   str       =   obj_ids[sorted_idxs] if obj_ids is not None else None
								UpperCAmelCase_     :   Optional[int]       =   obj_scores[sorted_idxs] if obj_scores is not None else None
								UpperCAmelCase_     :   Optional[Any]       =   attr_ids[sorted_idxs] if attr_ids is not None else None
								UpperCAmelCase_     :   List[str]       =   attr_scores[sorted_idxs] if attr_scores is not None else None

								UpperCAmelCase_     :   Any       =   [self._random_color(maximum=1     ) for _ in range(len(_UpperCamelCase     )     )]
								UpperCAmelCase_     :   int       =   [assigned_colors[idx] for idx in sorted_idxs]
								if obj_ids is not None:
											UpperCAmelCase_     :   List[Any]       =   self._create_text_labels_attr(_UpperCamelCase							,				_UpperCamelCase							,				_UpperCamelCase							,				_UpperCamelCase     )
											for i in range(len(_UpperCamelCase     )     ):
														UpperCAmelCase_     :   str       =   assigned_colors[i]
														self.add_box(boxes[i]							,				_UpperCamelCase     )
														self.draw_labels(labels[i]							,				boxes[i]							,				_UpperCamelCase     )




					def 						A     (       self       :						List[str]							,				_A       :						Optional[int]							,				_A       :						Dict							,				_A       :						Optional[int]     )  ->    Union[str, Any]:
								UpperCAmelCase_  ,     UpperCAmelCase_  ,     UpperCAmelCase_  ,     UpperCAmelCase_     :   Tuple       =   box
								UpperCAmelCase_     :   Union[str, Any]       =   (xa, ya)
								UpperCAmelCase_     :   Tuple       =   (ya - ya) * (xa - xa)
								UpperCAmelCase_     :   List[str]       =   _SMALL_OBJ * self.scale
								if instance_area < small or ya - ya < 40 * self.scale:
											if ya >= self.height - 5:
														UpperCAmelCase_     :   Tuple       =   (xa, ya)
											else:
														UpperCAmelCase_     :   List[Any]       =   (xa, ya)

								UpperCAmelCase_     :   List[Any]       =   (ya - ya) / np.sqrt(self.height * self.width     )
								UpperCAmelCase_     :   Optional[int]       =   self._change_color_brightness(_UpperCamelCase							,				brightness_factor=0.7     )
								UpperCAmelCase_     :   Tuple       =   np.clip((height_ratio - 0.02) / 0.08 + 1							,				1.2							,				2     )
								font_size *= 0.75 * self.font_size

								self.draw_text(
								    text=_UpperCamelCase							,				position=_UpperCamelCase							,				color=_UpperCamelCase							,				)




					def 						A     (       self       :						List[str]							,				_A       :						Any							,				_A       :						List[Any]							,				_A       :						str="g"							,				_A       :						List[Any]="left"							,				)  ->    List[str]:
								UpperCAmelCase_     :   Optional[int]       =   0
								UpperCAmelCase_     :   Union[str, Any]       =   self.font_size
								UpperCAmelCase_     :   Dict       =   np.maximum(list(mplc.to_rgb(_UpperCamelCase     )     )							,				0.2     )
								UpperCAmelCase_     :   Union[str, Any]       =   max(0.8							,				np.max(_UpperCamelCase     )     )
								UpperCAmelCase_     :   Union[str, Any]       =   {
								    '''facecolor''': '''black''',
								    '''alpha''': self.alpha,
								    '''pad''': self.pad,
								    '''edgecolor''': '''none''',
								}
								UpperCAmelCase_  ,     UpperCAmelCase_     :   Dict       =   position
								self.ax.text(
								    _UpperCamelCase							,				_UpperCamelCase							,				_UpperCamelCase							,				size=font_size * self.scale							,				family='''sans-serif'''							,				bbox=_UpperCamelCase							,				verticalalignment='''top'''							,				horizontalalignment=_UpperCamelCase							,				color=_UpperCamelCase							,				zorder=10							,				rotation=_UpperCamelCase							,				)




					def 						A     (       self       :						List[Any]							,				_A       :						Dict=None     )  ->    str:





								if saveas is None:
											UpperCAmelCase_     :   Union[str, Any]       =   self.saveas
								if saveas.lower().endswith('''.jpg'''     ) or saveas.lower().endswith('''.png'''     ):
											cva.imwrite(
											    _UpperCamelCase							,				self._get_buffer()[:, :, ::-1]							,				)
								else:
											self.fig.savefig(_UpperCamelCase     )




					def 						A     (       self       :						Any							,				_A       :						List[Any]							,				_A       :						int							,				_A       :						Tuple							,				_A       :						List[Any]     )  ->    Any:
								UpperCAmelCase_     :   Union[str, Any]       =   [self.idaobj[i] for i in classes]
								UpperCAmelCase_     :   Optional[int]       =   [self.idaattr[i] for i in attr_classes]
								UpperCAmelCase_     :   int       =   [
								    F"{label} {score:.2f} {attr} {attr_score:.2f}"
								    for label, score, attr, attr_score in zip(_UpperCamelCase							,				_UpperCamelCase							,				_UpperCamelCase							,				_UpperCamelCase     )
								]
								return labels




					def 						A     (       self       :						Optional[int]							,				_A       :						Dict							,				_A       :						Dict     )  ->    Union[str, Any]:
								UpperCAmelCase_     :   List[Any]       =   [self.idaobj[i] for i in classes]
								if scores is not None:
											if labels is None:
														UpperCAmelCase_     :   Optional[int]       =   ['''{:.0f}%'''.format(s * 1_00     ) for s in scores]
											else:
														UpperCAmelCase_     :   List[Any]       =   ['''{} {:.0f}%'''.format(_UpperCamelCase							,				s * 1_00     ) for li, s in zip(_UpperCamelCase							,				_UpperCamelCase     )]
								return labels




					def 						A     (       self       :						Optional[int]							,				_A       :						str=2_55     )  ->    Any:
								UpperCAmelCase_     :   str       =   np.random.randint(0							,				len(_COLORS     )     )
								UpperCAmelCase_     :   str       =   _COLORS[idx] * maximum
								if not self.rgb:
											UpperCAmelCase_     :   Dict       =   ret[::-1]
								return ret




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





								if not self.pynb:
											UpperCAmelCase_  ,     UpperCAmelCase_     :   Tuple       =   self.canvas.print_to_buffer()
											if (width, height) != (self.width, self.height):
														UpperCAmelCase_     :   int       =   cva.resize(self.img							,				(width, height)     )
											else:
														UpperCAmelCase_     :   Union[str, Any]       =   self.img
								else:
											UpperCAmelCase_     :   Dict       =   io.BytesIO()  # works for cairo backend
											self.canvas.print_rgba(_UpperCamelCase     )
											UpperCAmelCase_  ,     UpperCAmelCase_     :   Optional[Any]       =   self.width, self.height
											UpperCAmelCase_     :   int       =   buf.getvalue()
											UpperCAmelCase_     :   Optional[Any]       =   self.img

								UpperCAmelCase_     :   Tuple       =   np.frombuffer(_UpperCamelCase							,				dtype='''uint8'''     )
								UpperCAmelCase_     :   List[str]       =   buffer.reshape(_UpperCamelCase							,				_UpperCamelCase							,				4     )
								UpperCAmelCase_  ,     UpperCAmelCase_     :   Any       =   np.split(_UpperCamelCase							,				[3]							,				axis=2     )

								try:
											import numexpr as ne  # fuse them with numexpr

											UpperCAmelCase_     :   List[Any]       =   ne.evaluate('''img * (1 - alpha / 255.0) + rgb * (alpha / 255.0)'''     )
								except ImportError:
											UpperCAmelCase_     :   str       =   alpha.astype('''float32'''     ) / 255.0
											UpperCAmelCase_     :   Any       =   img * (1 - alpha) + rgb * alpha

								return visualized_image.astype('''uint8'''     )





					def 						A     (       self       :						List[Any]							,				_A       :						Dict							,				_A       :						Dict     )  ->    Optional[Any]:
								assert brightness_factor >= -1.0 and brightness_factor <= 1.0
								UpperCAmelCase_     :   List[Any]       =   mplc.to_rgb(_UpperCamelCase     )
								UpperCAmelCase_     :   int       =   colorsys.rgb_to_hls(*mplc.to_rgb(_UpperCamelCase     )     )
								UpperCAmelCase_     :   Optional[Any]       =   polygon_color[1] + (brightness_factor * polygon_color[1])
								UpperCAmelCase_     :   int       =   0.0 if modified_lightness < 0.0 else modified_lightness
								UpperCAmelCase_     :   Optional[int]       =   1.0 if modified_lightness > 1.0 else modified_lightness
								UpperCAmelCase_     :   Tuple       =   colorsys.hls_to_rgb(polygon_color[0]							,				_UpperCamelCase							,				polygon_color[2]     )
								return modified_color






_UpperCamelCase		:		Tuple								=			(
    np.array(
        [
            0.0_00,
            0.4_47,
            0.7_41,
            0.8_50,
            0.3_25,
            0.0_98,
            0.9_29,
            0.6_94,
            0.1_25,
            0.4_94,
            0.1_84,
            0.5_56,
            0.4_66,
            0.6_74,
            0.1_88,
            0.3_01,
            0.7_45,
            0.9_33,
            0.6_35,
            0.0_78,
            0.1_84,
            0.3_00,
            0.3_00,
            0.3_00,
            0.6_00,
            0.6_00,
            0.6_00,
            1.0_00,
            0.0_00,
            0.0_00,
            1.0_00,
            0.5_00,
            0.0_00,
            0.7_49,
            0.7_49,
            0.0_00,
            0.0_00,
            1.0_00,
            0.0_00,
            0.0_00,
            0.0_00,
            1.0_00,
            0.6_67,
            0.0_00,
            1.0_00,
            0.3_33,
            0.3_33,
            0.0_00,
            0.3_33,
            0.6_67,
            0.0_00,
            0.3_33,
            1.0_00,
            0.0_00,
            0.6_67,
            0.3_33,
            0.0_00,
            0.6_67,
            0.6_67,
            0.0_00,
            0.6_67,
            1.0_00,
            0.0_00,
            1.0_00,
            0.3_33,
            0.0_00,
            1.0_00,
            0.6_67,
            0.0_00,
            1.0_00,
            1.0_00,
            0.0_00,
            0.0_00,
            0.3_33,
            0.5_00,
            0.0_00,
            0.6_67,
            0.5_00,
            0.0_00,
            1.0_00,
            0.5_00,
            0.3_33,
            0.0_00,
            0.5_00,
            0.3_33,
            0.3_33,
            0.5_00,
            0.3_33,
            0.6_67,
            0.5_00,
            0.3_33,
            1.0_00,
            0.5_00,
            0.6_67,
            0.0_00,
            0.5_00,
            0.6_67,
            0.3_33,
            0.5_00,
            0.6_67,
            0.6_67,
            0.5_00,
            0.6_67,
            1.0_00,
            0.5_00,
            1.0_00,
            0.0_00,
            0.5_00,
            1.0_00,
            0.3_33,
            0.5_00,
            1.0_00,
            0.6_67,
            0.5_00,
            1.0_00,
            1.0_00,
            0.5_00,
            0.0_00,
            0.3_33,
            1.0_00,
            0.0_00,
            0.6_67,
            1.0_00,
            0.0_00,
            1.0_00,
            1.0_00,
            0.3_33,
            0.0_00,
            1.0_00,
            0.3_33,
            0.3_33,
            1.0_00,
            0.3_33,
            0.6_67,
            1.0_00,
            0.3_33,
            1.0_00,
            1.0_00,
            0.6_67,
            0.0_00,
            1.0_00,
            0.6_67,
            0.3_33,
            1.0_00,
            0.6_67,
            0.6_67,
            1.0_00,
            0.6_67,
            1.0_00,
            1.0_00,
            1.0_00,
            0.0_00,
            1.0_00,
            1.0_00,
            0.3_33,
            1.0_00,
            1.0_00,
            0.6_67,
            1.0_00,
            0.3_33,
            0.0_00,
            0.0_00,
            0.5_00,
            0.0_00,
            0.0_00,
            0.6_67,
            0.0_00,
            0.0_00,
            0.8_33,
            0.0_00,
            0.0_00,
            1.0_00,
            0.0_00,
            0.0_00,
            0.0_00,
            0.1_67,
            0.0_00,
            0.0_00,
            0.3_33,
            0.0_00,
            0.0_00,
            0.5_00,
            0.0_00,
            0.0_00,
            0.6_67,
            0.0_00,
            0.0_00,
            0.8_33,
            0.0_00,
            0.0_00,
            1.0_00,
            0.0_00,
            0.0_00,
            0.0_00,
            0.1_67,
            0.0_00,
            0.0_00,
            0.3_33,
            0.0_00,
            0.0_00,
            0.5_00,
            0.0_00,
            0.0_00,
            0.6_67,
            0.0_00,
            0.0_00,
            0.8_33,
            0.0_00,
            0.0_00,
            1.0_00,
            0.0_00,
            0.0_00,
            0.0_00,
            0.1_43,
            0.1_43,
            0.1_43,
            0.8_57,
            0.8_57,
            0.8_57,
            1.0_00,
            1.0_00,
            1.0_00,
        ]
    )
    .astype(np.floataa)
    .reshape(-1, 3)
)







'''simple docstring'''





import unittest

import numpy as np
import PIL
import torch

from diffusers.image_processor import VaeImageProcessor


class 				snake_case__     (			unittest.TestCase):




					@property
					def 						A     (       self       :						Optional[Any]     )  ->    int:
								UpperCAmelCase_     :   Optional[int]       =   1
								UpperCAmelCase_     :   List[str]       =   3
								UpperCAmelCase_     :   Optional[int]       =   8
								UpperCAmelCase_     :   Optional[Any]       =   8

								UpperCAmelCase_     :   Any       =   torch.rand((batch_size, num_channels, height, width)     )

								return sample




					def 						A     (       self       :						Dict							,				_A       :						str     )  ->    List[Any]:
								if isinstance(image[0]							,				PIL.Image.Image     ):
											return np.stack([np.array(_A     ) for i in image]							,				axis=0     )
								elif isinstance(_A							,				torch.Tensor     ):
											return image.cpu().numpy().transpose(0							,				2							,				3							,				1     )
								return image




					def 						A     (       self       :						Tuple     )  ->    Optional[Any]:
								UpperCAmelCase_     :   int       =   VaeImageProcessor(do_resize=_A							,				do_normalize=_A     )

								UpperCAmelCase_     :   List[Any]       =   self.dummy_sample
								UpperCAmelCase_     :   Optional[int]       =   self.to_np(_A     )

								for output_type in ["pt", "np", "pil"]:
											UpperCAmelCase_     :   Any       =   image_processor.postprocess(
											    image_processor.preprocess(_A     )							,				output_type=_A							,				)
											UpperCAmelCase_     :   Union[str, Any]       =   self.to_np(_A     )
											UpperCAmelCase_     :   Union[str, Any]       =   (input_np * 2_55).round() if output_type == '''pil''' else input_np
											assert (
											    np.abs(in_np - out_np     ).max() < 1e-6
											), F"decoded output does not match input for output_type {output_type}"




					def 						A     (       self       :						Optional[Any]     )  ->    int:
								UpperCAmelCase_     :   Union[str, Any]       =   VaeImageProcessor(do_resize=_A							,				do_normalize=_A     )
								UpperCAmelCase_     :   List[Any]       =   self.dummy_sample.cpu().numpy().transpose(0							,				2							,				3							,				1     )

								for output_type in ["pt", "np", "pil"]:
											UpperCAmelCase_     :   Union[str, Any]       =   image_processor.postprocess(image_processor.preprocess(_A     )							,				output_type=_A     )

											UpperCAmelCase_     :   List[Any]       =   self.to_np(_A     )
											UpperCAmelCase_     :   Any       =   (input_np * 2_55).round() if output_type == '''pil''' else input_np
											assert (
											    np.abs(in_np - out_np     ).max() < 1e-6
											), F"decoded output does not match input for output_type {output_type}"




					def 						A     (       self       :						Any     )  ->    Optional[Any]:
								UpperCAmelCase_     :   Tuple       =   VaeImageProcessor(do_resize=_A							,				do_normalize=_A     )

								UpperCAmelCase_     :   Optional[Any]       =   self.dummy_sample.cpu().numpy().transpose(0							,				2							,				3							,				1     )
								UpperCAmelCase_     :   List[Any]       =   image_processor.numpy_to_pil(_A     )

								for output_type in ["pt", "np", "pil"]:
											UpperCAmelCase_     :   str       =   image_processor.postprocess(image_processor.preprocess(_A     )							,				output_type=_A     )
											for i, o in zip(_A							,				_A     ):
														UpperCAmelCase_     :   Optional[int]       =   np.array(_A     )
														UpperCAmelCase_     :   Dict       =   self.to_np(_A     ) if output_type == '''pil''' else (self.to_np(_A     ) * 2_55).round()
														assert (
														    np.abs(in_np - out_np     ).max() < 1e-6
														), F"decoded output does not match input for output_type {output_type}"




					def 						A     (       self       :						Optional[Any]     )  ->    Optional[Any]:
								UpperCAmelCase_     :   int       =   VaeImageProcessor(do_resize=_A							,				do_normalize=_A     )

								UpperCAmelCase_     :   Optional[Any]       =   self.dummy_sample
								UpperCAmelCase_     :   Optional[Any]       =   input_pt_ad.squeeze(0     )

								UpperCAmelCase_     :   Tuple       =   image_processor.postprocess(
								    image_processor.preprocess(_A     )							,				output_type='''np'''							,				)
								UpperCAmelCase_     :   Any       =   image_processor.postprocess(
								    image_processor.preprocess(_A     )							,				output_type='''np'''							,				)

								UpperCAmelCase_     :   str       =   self.to_np(self.dummy_sample     )
								UpperCAmelCase_     :   Tuple       =   input_np_ad.squeeze(0     )

								UpperCAmelCase_     :   Optional[int]       =   image_processor.postprocess(
								    image_processor.preprocess(_A     )							,				output_type='''np'''							,				)
								UpperCAmelCase_     :   Optional[Any]       =   image_processor.postprocess(
								    image_processor.preprocess(_A     )							,				output_type='''np'''							,				)

								assert np.abs(out_pt_ad - out_pt_ad     ).max() < 1e-6
								assert np.abs(out_np_ad - out_np_ad     ).max() < 1e-6





					def 						A     (       self       :						Dict     )  ->    Dict:
								UpperCAmelCase_     :   List[Any]       =   VaeImageProcessor(do_resize=_A							,				do_normalize=_A     )

								UpperCAmelCase_     :   Optional[int]       =   self.dummy_sample
								UpperCAmelCase_     :   Dict       =   list(_A     )

								UpperCAmelCase_     :   str       =   image_processor.postprocess(
								    image_processor.preprocess(_A     )							,				output_type='''np'''							,				)

								UpperCAmelCase_     :   Optional[Any]       =   image_processor.postprocess(
								    image_processor.preprocess(_A     )							,				output_type='''np'''							,				)

								UpperCAmelCase_     :   Dict       =   self.to_np(self.dummy_sample     )
								list(_A     )

								UpperCAmelCase_     :   str       =   image_processor.postprocess(
								    image_processor.preprocess(_A     )							,				output_type='''np'''							,				)

								UpperCAmelCase_     :   Optional[int]       =   image_processor.postprocess(
								    image_processor.preprocess(_A     )							,				output_type='''np'''							,				)

								assert np.abs(out_pt_ad - out_pt_list     ).max() < 1e-6
								assert np.abs(out_np_ad - out_np_list     ).max() < 1e-6


