Fix fast image processor warnings in object detection examples (#35892)
Have the DETR examples default to using the fast image processor
This commit is contained in:
@@ -271,6 +271,10 @@ class DataTrainingArguments:
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
use_fast: Optional[bool] = field(
|
||||||
|
default=True,
|
||||||
|
metadata={"help": "Use a fast torchvision-base image processor if it is supported for a given model."},
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
@@ -427,6 +431,7 @@ def main():
|
|||||||
size={"max_height": data_args.image_square_size, "max_width": data_args.image_square_size},
|
size={"max_height": data_args.image_square_size, "max_width": data_args.image_square_size},
|
||||||
do_pad=True,
|
do_pad=True,
|
||||||
pad_size={"height": data_args.image_square_size, "width": data_args.image_square_size},
|
pad_size={"height": data_args.image_square_size, "width": data_args.image_square_size},
|
||||||
|
use_fast=data_args.use_fast,
|
||||||
**common_pretrained_args,
|
**common_pretrained_args,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -256,6 +256,12 @@ def parse_args():
|
|||||||
default=1333,
|
default=1333,
|
||||||
help="Image longest size will be resized to this value, then image will be padded to square.",
|
help="Image longest size will be resized to this value, then image will be padded to square.",
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--use_fast",
|
||||||
|
type=bool,
|
||||||
|
default=True,
|
||||||
|
help="Use a fast torchvision-base image processor if it is supported for a given model.",
|
||||||
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--cache_dir",
|
"--cache_dir",
|
||||||
type=str,
|
type=str,
|
||||||
@@ -482,6 +488,7 @@ def main():
|
|||||||
size={"max_height": args.image_square_size, "max_width": args.image_square_size},
|
size={"max_height": args.image_square_size, "max_width": args.image_square_size},
|
||||||
do_pad=True,
|
do_pad=True,
|
||||||
pad_size={"height": args.image_square_size, "width": args.image_square_size},
|
pad_size={"height": args.image_square_size, "width": args.image_square_size},
|
||||||
|
use_fast=args.use_fast,
|
||||||
**common_pretrained_args,
|
**common_pretrained_args,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user