fix preprocessor
Browse files- image_processing_keye.py +2 -4
- preprocessor_config.json +3 -3
image_processing_keye.py
CHANGED
|
@@ -129,7 +129,7 @@ def smart_resize(
|
|
| 129 |
width: int,
|
| 130 |
factor: int = 28,
|
| 131 |
min_pixels: int = 28 * 28 * 130,
|
| 132 |
-
max_pixels: int = 28 * 28 *
|
| 133 |
):
|
| 134 |
"""Rescales the image so that the following conditions are met:
|
| 135 |
|
|
@@ -223,7 +223,7 @@ class SiglipImageProcessor(BaseImageProcessor):
|
|
| 223 |
image_std: Optional[Union[float, List[float]]] = None,
|
| 224 |
do_convert_rgb: bool = True,
|
| 225 |
min_pixels: int = 28 * 28 * 130,
|
| 226 |
-
max_pixels: int = 28 * 28 *
|
| 227 |
patch_size: int = 14,
|
| 228 |
temporal_patch_size: int = 1,
|
| 229 |
merge_size: int = 2,
|
|
@@ -357,7 +357,6 @@ class SiglipImageProcessor(BaseImageProcessor):
|
|
| 357 |
processed_images = []
|
| 358 |
|
| 359 |
for image in images:
|
| 360 |
-
# image = self.mvit_rescale(image, merge_size=self.merge_size)
|
| 361 |
if do_resize:
|
| 362 |
resized_height, resized_width = smart_resize(
|
| 363 |
height,
|
|
@@ -385,7 +384,6 @@ class SiglipImageProcessor(BaseImageProcessor):
|
|
| 385 |
std=image_std,
|
| 386 |
input_data_format=input_data_format,
|
| 387 |
)
|
| 388 |
-
|
| 389 |
image = to_channel_dimension_format(
|
| 390 |
image, data_format, input_channel_dim=input_data_format
|
| 391 |
)
|
|
|
|
| 129 |
width: int,
|
| 130 |
factor: int = 28,
|
| 131 |
min_pixels: int = 28 * 28 * 130,
|
| 132 |
+
max_pixels: int = 28 * 28 * 1280,
|
| 133 |
):
|
| 134 |
"""Rescales the image so that the following conditions are met:
|
| 135 |
|
|
|
|
| 223 |
image_std: Optional[Union[float, List[float]]] = None,
|
| 224 |
do_convert_rgb: bool = True,
|
| 225 |
min_pixels: int = 28 * 28 * 130,
|
| 226 |
+
max_pixels: int = 28 * 28 * 1280,
|
| 227 |
patch_size: int = 14,
|
| 228 |
temporal_patch_size: int = 1,
|
| 229 |
merge_size: int = 2,
|
|
|
|
| 357 |
processed_images = []
|
| 358 |
|
| 359 |
for image in images:
|
|
|
|
| 360 |
if do_resize:
|
| 361 |
resized_height, resized_width = smart_resize(
|
| 362 |
height,
|
|
|
|
| 384 |
std=image_std,
|
| 385 |
input_data_format=input_data_format,
|
| 386 |
)
|
|
|
|
| 387 |
image = to_channel_dimension_format(
|
| 388 |
image, data_format, input_channel_dim=input_data_format
|
| 389 |
)
|
preprocessor_config.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
-
"min_pixels":
|
| 3 |
-
"max_pixels":
|
| 4 |
"patch_size": 14,
|
| 5 |
"temporal_patch_size": 1,
|
| 6 |
"merge_size": 2,
|
|
@@ -15,4 +15,4 @@
|
|
| 15 |
"AutoProcessor": "processing_keye.KeyeProcessor",
|
| 16 |
"AutoImageProcessor": "image_processing_keye.SiglipImageProcessor"
|
| 17 |
}
|
| 18 |
-
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"min_pixels": 102400,
|
| 3 |
+
"max_pixels": 1003520,
|
| 4 |
"patch_size": 14,
|
| 5 |
"temporal_patch_size": 1,
|
| 6 |
"merge_size": 2,
|
|
|
|
| 15 |
"AutoProcessor": "processing_keye.KeyeProcessor",
|
| 16 |
"AutoImageProcessor": "image_processing_keye.SiglipImageProcessor"
|
| 17 |
}
|
| 18 |
+
}
|