qubvel / efficientnet

Implementation of EfficientNet model. Keras and TensorFlow Keras.
https://arxiv.org/abs/1905.11946
Apache License 2.0
2.07k stars 472 forks source link

Center crop preprocessing is different from original #126

Open DavideStenner opened 4 years ago

DavideStenner commented 4 years ago

Hi i was looking at your center_crop_and_resize preprocessing function and i found that is different from original for 1 parameter. In your function you set to preserve the range of values when you call resize function from:

image_crop = image[
             offset_height: padded_center_crop_size + offset_height,
             offset_width: padded_center_crop_size + offset_width,
             ]
resized_image = resize(
    image_crop,
    (image_size, image_size),
    order=MAP_INTERPOLATION_TO_ORDER[interpolation],
    preserve_range=True,
)

By looking at original code:

https://github.com/tensorflow/tpu/blob/d35e48588cfdab24aaddd045e37d0e967166931f/models/official/efficientnet/preprocessing.py#L118-L135

there isn't any preserve_range parameter.

If you set preserve_range = False you obtain same results as original code