Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/transformers/models/owlv2/image_processing_owlv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ def pad(
image = pad(
image=image,
padding=((0, size - height), (0, size - width)),
constant_values=0.5,
constant_values=0.0,
data_format=data_format,
input_data_format=input_data_format,
)
Expand Down
6 changes: 3 additions & 3 deletions src/transformers/models/owlv2/image_processing_owlv2_fast.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def post_process_image_guided_detection(self, outputs, threshold=0.0, nms_thresh

return results

def _pad_images(self, images: "torch.Tensor", constant_value: float = 0.5) -> "torch.Tensor":
def _pad_images(self, images: "torch.Tensor", constant_value: float = 0.0) -> "torch.Tensor":
"""
Pad an image with zeros to the given size.
"""
Expand All @@ -245,7 +245,7 @@ def pad(
self,
images: list["torch.Tensor"],
disable_grouping: Optional[bool],
constant_value: float = 0.5,
constant_value: float = 0.0,
**kwargs,
) -> list["torch.Tensor"]:
"""
Expand Down Expand Up @@ -351,7 +351,7 @@ def _preprocess(
processed_images = reorder_images(processed_images_grouped, grouped_images_index)

if do_pad:
processed_images = self.pad(processed_images, constant_value=0.5, disable_grouping=disable_grouping)
processed_images = self.pad(processed_images, constant_value=0.0, disable_grouping=disable_grouping)

grouped_images, grouped_images_index = group_images_by_shape(
processed_images, disable_grouping=disable_grouping
Expand Down
6 changes: 3 additions & 3 deletions src/transformers/models/owlv2/modular_owlv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class Owlv2ImageProcessorFast(OwlViTImageProcessorFast):
crop_size = None
do_center_crop = None

def _pad_images(self, images: "torch.Tensor", constant_value: float = 0.5) -> "torch.Tensor":
def _pad_images(self, images: "torch.Tensor", constant_value: float = 0.0) -> "torch.Tensor":
"""
Pad an image with zeros to the given size.
"""
Expand All @@ -69,7 +69,7 @@ def pad(
self,
images: list["torch.Tensor"],
disable_grouping: Optional[bool],
constant_value: float = 0.5,
constant_value: float = 0.0,
**kwargs,
) -> list["torch.Tensor"]:
"""
Expand Down Expand Up @@ -175,7 +175,7 @@ def _preprocess(
processed_images = reorder_images(processed_images_grouped, grouped_images_index)

if do_pad:
processed_images = self.pad(processed_images, constant_value=0.5, disable_grouping=disable_grouping)
processed_images = self.pad(processed_images, constant_value=0.0, disable_grouping=disable_grouping)

grouped_images, grouped_images_index = group_images_by_shape(
processed_images, disable_grouping=disable_grouping
Expand Down