


"""simple docstring"""





import warnings
from typing import List, Optional, Union

import numpy as np
import PIL
import torch
from PIL import Image

from .configuration_utils import ConfigMixin, register_to_config
from .utils import CONFIG_NAME, PIL_INTERPOLATION, deprecate



class 		snake_case_(							a__      ):
     __UpperCamelCase	=       CONFIG_NAME






     @register_to_config
     def __init__(						self	:       Optional[int]       ,					UpperCamelCase_	:       bool = True       ,					UpperCamelCase_	:       int = 8       ,					UpperCamelCase_	:       str = "lanczos"       ,					UpperCamelCase_	:       bool = True       ,					UpperCamelCase_	:       bool = False       ,					):
           super().__init__()






     @staticmethod
     def   lowerCamelCase__  (						UpperCamelCase_	:       np.ndarray					):
           if images.ndim == 3:
                 lowerCAmelCase       :						Dict							= images[None, ...]
           lowerCAmelCase       :						Union[str, Any]							= (images * 2_5_5).round().astype('''uint8'''					)
           if images.shape[-1] == 1:
                 # special case for grayscale (single channel) images
                 lowerCAmelCase       :						int							= [Image.fromarray(image.squeeze()       ,					mode='''L'''					) for image in images]
           else:
                 lowerCAmelCase       :						Union[str, Any]							= [Image.fromarray(UpperCamelCase_					) for image in images]

           return pil_images






     @staticmethod
     def   lowerCamelCase__  (						UpperCamelCase_	:       Union[List[PIL.Image.Image], PIL.Image.Image]					):
           if not isinstance(UpperCamelCase_       ,					UpperCamelCase_					):
                 lowerCAmelCase       :						int							= [images]
           lowerCAmelCase       :						str							= [np.array(UpperCamelCase_					).astype(np.floataa					) / 255.0 for image in images]
           lowerCAmelCase       :						Optional[Any]							= np.stack(UpperCamelCase_       ,					axis=0					)

           return images






     @staticmethod
     def   lowerCamelCase__  (						UpperCamelCase_	:       np.ndarray					):
           if images.ndim == 3:
                 lowerCAmelCase       :						Tuple							= images[..., None]

           lowerCAmelCase       :						int							= torch.from_numpy(images.transpose(0       ,					3       ,					1       ,					2					)					)
           return images






     @staticmethod
     def   lowerCamelCase__  (						UpperCamelCase_	:       torch.FloatTensor					):
           lowerCAmelCase       :						Optional[Any]							= images.cpu().permute(0       ,					2       ,					3       ,					1					).float().numpy()
           return images






     @staticmethod
     def   lowerCamelCase__  (						UpperCamelCase_	:       Optional[int]					):
           return 2.0 * images - 1.0






     @staticmethod
     def   lowerCamelCase__  (						UpperCamelCase_	:       Any					):
           return (images / 2 + 0.5).clamp(0       ,					1					)






     @staticmethod
     def   lowerCamelCase__  (						UpperCamelCase_	:       PIL.Image.Image					):
           lowerCAmelCase       :						str							= image.convert('''RGB'''					)
           return image






     def   lowerCamelCase__  (						self	:       Tuple       ,					UpperCamelCase_	:       PIL.Image.Image       ,					UpperCamelCase_	:       Optional[int] = None       ,					UpperCamelCase_	:       Optional[int] = None       ,					):
           if height is None:
                 lowerCAmelCase       :						Dict							= image.height
           if width is None:
                 lowerCAmelCase       :						str							= image.width

           lowerCAmelCase,   lowerCAmelCase       :						Optional[Any]							= (
               x - x % self.config.vae_scale_factor for x in (width, height)
           )  # resize to integer multiple of vae_scale_factor
           lowerCAmelCase       :						Optional[int]							= image.resize((width, height)       ,					resample=PIL_INTERPOLATION[self.config.resample]					)
           return image






     def   lowerCamelCase__  (						self	:       Optional[Any]       ,					UpperCamelCase_	:       Union[torch.FloatTensor, PIL.Image.Image, np.ndarray]       ,					UpperCamelCase_	:       Optional[int] = None       ,					UpperCamelCase_	:       Optional[int] = None       ,					):
           lowerCAmelCase       :						List[Any]							= (PIL.Image.Image, np.ndarray, torch.Tensor)
           if isinstance(UpperCamelCase_       ,					UpperCamelCase_					):
                 lowerCAmelCase       :						Optional[int]							= [image]
           elif not (isinstance(UpperCamelCase_       ,					UpperCamelCase_					) and all(isinstance(UpperCamelCase_       ,					UpperCamelCase_					) for i in image					)):
                 raise ValueError(
                     F'''Input is in incorrect format: {[type(UpperCamelCase_					) for i in image]}. Currently, we only support {", ".join(UpperCamelCase_					)}'''					)

           if isinstance(image[0]       ,					PIL.Image.Image					):
                 if self.config.do_convert_rgb:
                       lowerCAmelCase       :						List[str]							= [self.convert_to_rgb(UpperCamelCase_					) for i in image]
                 if self.config.do_resize:
                       lowerCAmelCase       :						List[str]							= [self.resize(UpperCamelCase_       ,					UpperCamelCase_       ,					UpperCamelCase_					) for i in image]
                 lowerCAmelCase       :						Optional[Any]							= self.pil_to_numpy(UpperCamelCase_					)  # to np
                 lowerCAmelCase       :						Optional[int]							= self.numpy_to_pt(UpperCamelCase_					)  # to pt

           elif isinstance(image[0]       ,					np.ndarray					):
                 lowerCAmelCase       :						Optional[int]							= np.concatenate(UpperCamelCase_       ,					axis=0					) if image[0].ndim == 4 else np.stack(UpperCamelCase_       ,					axis=0					)
                 lowerCAmelCase       :						List[Any]							= self.numpy_to_pt(UpperCamelCase_					)
                 lowerCAmelCase,   lowerCAmelCase,   lowerCAmelCase,   lowerCAmelCase       :						List[str]							= image.shape
                 if self.config.do_resize and (
                     height % self.config.vae_scale_factor != 0 or width % self.config.vae_scale_factor != 0
                 ):
                       raise ValueError(
                           F'''Currently we only support resizing for PIL image - please resize your numpy array to be divisible by {self.config.vae_scale_factor}'''
                           F'''currently the sizes are {height} and {width}. You can also pass a PIL image instead to use resize option in VAEImageProcessor'''					)

           elif isinstance(image[0]       ,					torch.Tensor					):
                 lowerCAmelCase       :						Tuple							= torch.cat(UpperCamelCase_       ,					axis=0					) if image[0].ndim == 4 else torch.stack(UpperCamelCase_       ,					axis=0					)
                 lowerCAmelCase,   lowerCAmelCase,   lowerCAmelCase,   lowerCAmelCase       :						Tuple							= image.shape

                 # don't need any preprocess if the image is latents
                 if channel == 4:
                       return image

                 if self.config.do_resize and (
                     height % self.config.vae_scale_factor != 0 or width % self.config.vae_scale_factor != 0
                 ):
                       raise ValueError(
                           F'''Currently we only support resizing for PIL image - please resize your pytorch tensor to be divisible by {self.config.vae_scale_factor}'''
                           F'''currently the sizes are {height} and {width}. You can also pass a PIL image instead to use resize option in VAEImageProcessor'''					)

        # expected range [0,1], normalize to [-1,1]
           lowerCAmelCase       :						Optional[Any]							= self.config.do_normalize
           if image.min() < 0:
                 warnings.warn(
                     '''Passing `image` as torch tensor with value range in [-1,1] is deprecated. The expected value range for image tensor is [0,1] '''
                     F'''when passing as pytorch tensor or numpy Array. You passed `image` with value range [{image.min()},{image.max()}]'''       ,					UpperCamelCase_       ,					)
                 lowerCAmelCase       :						Any							= False

           if do_normalize:
                 lowerCAmelCase       :						str							= self.normalize(UpperCamelCase_					)

           return image






     def   lowerCamelCase__  (						self	:       List[Any]       ,					UpperCamelCase_	:       torch.FloatTensor       ,					UpperCamelCase_	:       str = "pil"       ,					UpperCamelCase_	:       Optional[List[bool]] = None       ,					):
           if not isinstance(UpperCamelCase_       ,					torch.Tensor					):
                 raise ValueError(
                     F'''Input for postprocessing is in incorrect format: {type(UpperCamelCase_					)}. We only support pytorch tensor'''					)
           if output_type not in ["latent", "pt", "np", "pil"]:
                 lowerCAmelCase       :						Union[str, Any]							= (
                     F'''the output_type {output_type} is outdated and has been set to `np`. Please make sure to set it to one of these instead: '''
                     '''`pil`, `np`, `pt`, `latent`'''
                 )
                 deprecate('''Unsupported output_type'''       ,					'''1.0.0'''       ,					UpperCamelCase_       ,					standard_warn=UpperCamelCase_					)
                 lowerCAmelCase       :						Dict							= '''np'''

           if output_type == "latent":
                 return image

           if do_denormalize is None:
                 lowerCAmelCase       :						Union[str, Any]							= [self.config.do_normalize] * image.shape[0]

           lowerCAmelCase       :						str							= torch.stack(
               [self.denormalize(image[i]					) if do_denormalize[i] else image[i] for i in range(image.shape[0]					)]					)

           if output_type == "pt":
                 return image

           lowerCAmelCase       :						Tuple							= self.pt_to_numpy(UpperCamelCase_					)

           if output_type == "np":
                 return image

           if output_type == "pil":
                 return self.numpy_to_pil(UpperCamelCase_					)



class 		snake_case_(							a__      ):
     __UpperCamelCase	=       CONFIG_NAME






     @register_to_config
     def __init__(						self	:       Dict       ,					UpperCamelCase_	:       bool = True       ,					UpperCamelCase_	:       int = 8       ,					UpperCamelCase_	:       str = "lanczos"       ,					UpperCamelCase_	:       bool = True       ,					):
           super().__init__()






     @staticmethod
     def   lowerCamelCase__  (						UpperCamelCase_	:       Dict					):
           if images.ndim == 3:
                 lowerCAmelCase       :						Any							= images[None, ...]
           lowerCAmelCase       :						Optional[Any]							= (images * 2_5_5).round().astype('''uint8'''					)
           if images.shape[-1] == 1:
                 # special case for grayscale (single channel) images
                 lowerCAmelCase       :						Optional[int]							= [Image.fromarray(image.squeeze()       ,					mode='''L'''					) for image in images]
           else:
                 lowerCAmelCase       :						Tuple							= [Image.fromarray(image[:, :, :3]					) for image in images]

           return pil_images






     @staticmethod
     def   lowerCamelCase__  (						UpperCamelCase_	:       List[str]					):
           return image[:, :, 1] * 2**8 + image[:, :, 2]






     def   lowerCamelCase__  (						self	:       List[str]       ,					UpperCamelCase_	:       List[Any]					):
           if images.ndim == 3:
                 lowerCAmelCase       :						Optional[Any]							= images[None, ...]
           lowerCAmelCase       :						List[Any]							= images[:, :, :, 3:]
           if images.shape[-1] == 6:
                 lowerCAmelCase       :						Dict							= (images_depth * 2_5_5).round().astype('''uint8'''					)
                 lowerCAmelCase       :						Optional[int]							= [
                     Image.fromarray(self.rgblike_to_depthmap(UpperCamelCase_					)       ,					mode='''I;16'''					) for image_depth in images_depth
                 ]
           elif images.shape[-1] == 4:
                 lowerCAmelCase       :						int							= (images_depth * 65_535.0).astype(np.uintaa					)
                 lowerCAmelCase       :						str							= [Image.fromarray(UpperCamelCase_       ,					mode='''I;16'''					) for image_depth in images_depth]
           else:
                 raise Exception('''Not supported'''					)

           return pil_images






     def   lowerCamelCase__  (						self	:       List[str]       ,					UpperCamelCase_	:       torch.FloatTensor       ,					UpperCamelCase_	:       str = "pil"       ,					UpperCamelCase_	:       Optional[List[bool]] = None       ,					):
           if not isinstance(UpperCamelCase_       ,					torch.Tensor					):
                 raise ValueError(
                     F'''Input for postprocessing is in incorrect format: {type(UpperCamelCase_					)}. We only support pytorch tensor'''					)
           if output_type not in ["latent", "pt", "np", "pil"]:
                 lowerCAmelCase       :						List[Any]							= (
                     F'''the output_type {output_type} is outdated and has been set to `np`. Please make sure to set it to one of these instead: '''
                     '''`pil`, `np`, `pt`, `latent`'''
                 )
                 deprecate('''Unsupported output_type'''       ,					'''1.0.0'''       ,					UpperCamelCase_       ,					standard_warn=UpperCamelCase_					)
                 lowerCAmelCase       :						Union[str, Any]							= '''np'''

           if do_denormalize is None:
                 lowerCAmelCase       :						int							= [self.config.do_normalize] * image.shape[0]

           lowerCAmelCase       :						Dict							= torch.stack(
               [self.denormalize(image[i]					) if do_denormalize[i] else image[i] for i in range(image.shape[0]					)]					)

           lowerCAmelCase       :						Optional[Any]							= self.pt_to_numpy(UpperCamelCase_					)

           if output_type == "np":
                 if image.shape[-1] == 6:
                       lowerCAmelCase       :						Dict							= np.stack([self.rgblike_to_depthmap(im[:, :, 3:]					) for im in image]       ,					axis=0					)
                 else:
                       lowerCAmelCase       :						str							= image[:, :, :, 3:]
                 return image[:, :, :, :3], image_depth

           if output_type == "pil":
                 return self.numpy_to_pil(UpperCamelCase_					), self.numpy_to_depth(UpperCamelCase_					)
           else:
                 raise Exception(F'''This type {output_type} is not supported'''					)






"""simple docstring"""





import argparse
import json
from pathlib import Path

import requests
import torch
from huggingface_hub import cached_download, hf_hub_url
from PIL import Image

from transformers import DeformableDetrConfig, DeformableDetrForObjectDetection, DeformableDetrImageProcessor
from transformers.utils import logging


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


def   _snake_case    (    _snake_case					:      Tuple      ):
      if "backbone.0.body" in orig_key:
            lowerCAmelCase       :						Tuple							= orig_key.replace('''backbone.0.body'''			, '''backbone.conv_encoder.model'''      )
      if "transformer" in orig_key:
            lowerCAmelCase       :						str							= orig_key.replace('''transformer.'''			, ''''''      )
      if "norm1" in orig_key:
            if "encoder" in orig_key:
                  lowerCAmelCase       :						List[Any]							= orig_key.replace('''norm1'''			, '''self_attn_layer_norm'''      )
            else:
                  lowerCAmelCase       :						str							= orig_key.replace('''norm1'''			, '''encoder_attn_layer_norm'''      )
      if "norm2" in orig_key:
            if "encoder" in orig_key:
                  lowerCAmelCase       :						Union[str, Any]							= orig_key.replace('''norm2'''			, '''final_layer_norm'''      )
            else:
                  lowerCAmelCase       :						Optional[int]							= orig_key.replace('''norm2'''			, '''self_attn_layer_norm'''      )
      if "norm3" in orig_key:
            lowerCAmelCase       :						Dict							= orig_key.replace('''norm3'''			, '''final_layer_norm'''      )
      if "linear1" in orig_key:
            lowerCAmelCase       :						Tuple							= orig_key.replace('''linear1'''			, '''fc1'''      )
      if "linear2" in orig_key:
            lowerCAmelCase       :						Tuple							= orig_key.replace('''linear2'''			, '''fc2'''      )
      if "query_embed" in orig_key:
            lowerCAmelCase       :						str							= orig_key.replace('''query_embed'''			, '''query_position_embeddings'''      )
      if "cross_attn" in orig_key:
            lowerCAmelCase       :						Tuple							= orig_key.replace('''cross_attn'''			, '''encoder_attn'''      )

      return orig_key


def   _snake_case    (    _snake_case					:      List[str]      ):
      # transformer decoder self-attention layers
      for i in range(6      ):
            # read in weights + bias of input projection layer of self-attention
            lowerCAmelCase       :						str							= state_dict.pop(f'''decoder.layers.{i}.self_attn.in_proj_weight'''      )
            lowerCAmelCase       :						str							= state_dict.pop(f'''decoder.layers.{i}.self_attn.in_proj_bias'''      )
            # next, add query, keys and values (in that order) to the state dict
            lowerCAmelCase       :						Tuple							= in_proj_weight[:256, :]
            lowerCAmelCase       :						Optional[int]							= in_proj_bias[:256]
            lowerCAmelCase       :						int							= in_proj_weight[256:512, :]
            lowerCAmelCase       :						Optional[int]							= in_proj_bias[256:512]
            lowerCAmelCase       :						Any							= in_proj_weight[-256:, :]
            lowerCAmelCase       :						str							= in_proj_bias[-256:]


def   _snake_case    (    ):
      lowerCAmelCase       :						List[str]							= '''http://images.cocodataset.org/val2017/000000039769.jpg'''
      lowerCAmelCase       :						Dict							= Image.open(requests.get(_snake_case			, stream=_snake_case      ).raw      )

      return im


@torch.no_grad()
def   _snake_case    (    _snake_case					:      List[Any]			, _snake_case					:      Dict			, _snake_case					:      str			, _snake_case					:      Any			, _snake_case					:      str			, _snake_case					:      str			, _snake_case					:      Dict			, ):
      lowerCAmelCase       :						List[str]							= DeformableDetrConfig()
      # set config attributes
      if single_scale:
            lowerCAmelCase       :						Dict							= 1
      lowerCAmelCase       :						Optional[int]							= dilation
      lowerCAmelCase       :						str							= with_box_refine
      lowerCAmelCase       :						str							= two_stage
      # set labels
      lowerCAmelCase       :						Dict							= 91
      lowerCAmelCase       :						Any							= '''huggingface/label-files'''
      lowerCAmelCase       :						Any							= '''coco-detection-id2label.json'''
      lowerCAmelCase       :						Optional[int]							= json.load(open(cached_download(hf_hub_url(_snake_case			, _snake_case			, repo_type='''dataset'''      )      )			, '''r'''      )      )
      lowerCAmelCase       :						Optional[Any]							= {int(_snake_case      ): v for k, v in idalabel.items()}
      lowerCAmelCase       :						int							= idalabel
      lowerCAmelCase       :						str							= {v: k for k, v in idalabel.items()}

      # load image processor
      lowerCAmelCase       :						str							= DeformableDetrImageProcessor(format='''coco_detection'''      )

      # prepare image
      lowerCAmelCase       :						Tuple							= prepare_img()
      lowerCAmelCase       :						int							= image_processor(images=_snake_case			, return_tensors='''pt'''      )
      lowerCAmelCase       :						int							= encoding['''pixel_values''']

      logger.info('''Converting model...'''      )

      # load original state dict
      lowerCAmelCase       :						Tuple							= torch.load(_snake_case			, map_location='''cpu'''      )['''model''']
      # rename keys
      for key in state_dict.copy().keys():
            lowerCAmelCase       :						Dict							= state_dict.pop(_snake_case      )
            lowerCAmelCase       :						Optional[Any]							= val
      # query, key and value matrices need special treatment
      read_in_q_k_v(_snake_case      )
      # important: we need to prepend a prefix to each of the base model keys as the head models use different attributes for them
      lowerCAmelCase       :						List[str]							= '''model.'''
      for key in state_dict.copy().keys():
            if not key.startswith('''class_embed'''      ) and not key.startswith('''bbox_embed'''      ):
                  lowerCAmelCase       :						Union[str, Any]							= state_dict.pop(_snake_case      )
                  lowerCAmelCase       :						str							= val
    # finally, create HuggingFace model and load state dict
      lowerCAmelCase       :						Any							= DeformableDetrForObjectDetection(_snake_case      )
      model.load_state_dict(_snake_case      )
      model.eval()

      lowerCAmelCase       :						List[str]							= '''cuda''' if torch.cuda.is_available() else '''cpu'''
      model.to(_snake_case      )
      # verify our conversion
      lowerCAmelCase       :						Dict							= model(pixel_values.to(_snake_case      )      )

      lowerCAmelCase       :						Union[str, Any]							= torch.tensor(
          [[-9.6645, -4.3449, -5.8705], [-9.7035, -3.8504, -5.0724], [-10.5634, -5.3379, -7.5116]]      )
      lowerCAmelCase       :						Dict							= torch.tensor([[0.8693, 0.2289, 0.2492], [0.3150, 0.5489, 0.5845], [0.5563, 0.7580, 0.8518]]      )

      if single_scale:
            lowerCAmelCase       :						List[Any]							= torch.tensor(
                [[-9.9051, -4.2541, -6.4852], [-9.6947, -4.0854, -6.8033], [-10.0665, -5.8470, -7.7003]]      )
            lowerCAmelCase       :						int							= torch.tensor([[0.7292, 0.4991, 0.5532], [0.7959, 0.2426, 0.4236], [0.7582, 0.3518, 0.4451]]      )

      if single_scale and dilation:
            lowerCAmelCase       :						str							= torch.tensor(
                [[-8.9652, -4.1074, -5.6635], [-9.0596, -4.9447, -6.6075], [-10.1178, -4.5275, -6.2671]]      )
            lowerCAmelCase       :						Tuple							= torch.tensor([[0.7665, 0.4130, 0.4769], [0.8364, 0.1841, 0.3391], [0.6261, 0.3895, 0.7978]]      )

      if with_box_refine:
            lowerCAmelCase       :						Optional[Any]							= torch.tensor(
                [[-8.8895, -5.4187, -6.8153], [-8.4706, -6.1668, -7.6184], [-9.0042, -5.5359, -6.9141]]      )
            lowerCAmelCase       :						List[str]							= torch.tensor([[0.7828, 0.2208, 0.4323], [0.0892, 0.5996, 0.1319], [0.5524, 0.6389, 0.8914]]      )

      if with_box_refine and two_stage:
            lowerCAmelCase       :						Dict							= torch.tensor(
                [[-6.7108, -4.3213, -6.3777], [-8.9014, -6.1799, -6.7240], [-6.9315, -4.4735, -6.2298]]      )
            lowerCAmelCase       :						Union[str, Any]							= torch.tensor([[0.2583, 0.5499, 0.4683], [0.7652, 0.9068, 0.4882], [0.5490, 0.2763, 0.0564]]      )

      print('''Logits:'''			, outputs.logits[0, :3, :3]      )

      assert torch.allclose(outputs.logits[0, :3, :3]			, expected_logits.to(_snake_case      )			, atol=1E-4      )
      assert torch.allclose(outputs.pred_boxes[0, :3, :3]			, expected_boxes.to(_snake_case      )			, atol=1E-4      )

      print('''Everything ok!'''      )

      # Save model and image processor
      logger.info(f'''Saving PyTorch model and image processor to {pytorch_dump_folder_path}...'''      )
      Path(_snake_case      ).mkdir(exist_ok=_snake_case      )
      model.save_pretrained(_snake_case      )
      image_processor.save_pretrained(_snake_case      )

      # Push to hub
      if push_to_hub:
            lowerCAmelCase       :						Optional[Any]							= '''deformable-detr'''
            model_name += "-single-scale" if single_scale else ""
            model_name += "-dc5" if dilation else ""
            model_name += "-with-box-refine" if with_box_refine else ""
            model_name += "-two-stage" if two_stage else ""
            print('''Pushing model to hub...'''      )
            model.push_to_hub(repo_path_or_name=_snake_case			, organization='''nielsr'''			, commit_message='''Add model'''      )


if __name__ == "__main__":
 snake_case__		:  Union[str, Any]     					=					argparse.ArgumentParser()

 parser.add_argument(
     '''--checkpoint_path''',
     type=str,
     default='''/home/niels/checkpoints/deformable_detr/r50_deformable_detr-checkpoint.pth''',
     help='''Path to Pytorch checkpoint (.pth file) you\'d like to convert.''',
 )
 parser.add_argument('''--single_scale''', action='''store_true''', help='''Whether to set config.num_features_levels = 1.''')
 parser.add_argument('''--dilation''', action='''store_true''', help='''Whether to set config.dilation=True.''')
 parser.add_argument('''--with_box_refine''', action='''store_true''', help='''Whether to set config.with_box_refine=True.''')
 parser.add_argument('''--two_stage''', action='''store_true''', help='''Whether to set config.two_stage=True.''')
 parser.add_argument(
     '''--pytorch_dump_folder_path''',
     default=None,
     type=str,
     required=True,
     help='''Path to the folder to output PyTorch model.''',
 )
 parser.add_argument(
     '''--push_to_hub''', action='''store_true''', help='''Whether or not to push the converted model to the 🤗 hub.'''
 )
 snake_case__		:  Union[str, Any]     					=					parser.parse_args()
 convert_deformable_detr_checkpoint(
     args.checkpoint_path,
     args.single_scale,
     args.dilation,
     args.with_box_refine,
     args.two_stage,
     args.pytorch_dump_folder_path,
     args.push_to_hub,
 )


