https://github.com/trevor-m/tensorflow-bicubic-downsample
tf.image.resize_images has aliasing when downsampling and does not have gradients for bicubic mode. This implementation fixes those problems.
https://github.com/trevor-m/tensorflow-bicubic-downsample
aliasing bicubic deep-learning downsample gradients image-processing image-resizing images resize-images super-resolution tensorflow
Last synced: 27 days ago
JSON representation
tf.image.resize_images has aliasing when downsampling and does not have gradients for bicubic mode. This implementation fixes those problems.
- Host: GitHub
- URL: https://github.com/trevor-m/tensorflow-bicubic-downsample
- Owner: trevor-m
- License: mit
- Created: 2018-05-17T04:30:29.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-05-03T19:51:45.000Z (about 6 years ago)
- Last Synced: 2024-11-09T22:38:10.151Z (6 months ago)
- Topics: aliasing, bicubic, deep-learning, downsample, gradients, image-processing, image-resizing, images, resize-images, super-resolution, tensorflow
- Language: Python
- Size: 12.7 KB
- Stars: 24
- Watchers: 2
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tensorflow-bicubic-downsample
tf.image.resize_images has aliasing when downsampling and does not define gradients for bicubic mode. This implementation fixes those problems.# Example
These images have been downsampled by a factor of 4 from the original. The results from this code matches the scipy.misc.imresize results exactly.Method | Result | Comments
--- | --- | ---
Original || This is the original full res image.
tf.images.resize_images || TF's implementation has aliasing
scipy.misc.imresize || Proper bicubic downsampling
This code || Matches scipy exactly
# Usage
```python
from bicubic_downsample import build_filter, apply_bicubic_downsample# First, create the bicubic kernel. This can be reused in multiple downsample operations
k = build_filter(factor=4)# Downsample x which is a tensor with shape [N, H, W, 3]
y = apply_bicubic_downsample(x, filter=k, factor=4)# y now contains x downsampled to [N, H/4, W/4, 3]
```