eldar / pose-tensorflow

Human Pose estimation with TensorFlow framework
GNU Lesser General Public License v3.0
1.14k stars 384 forks source link

replacing deprecated imresize #103

Open cxrodgers opened 5 years ago

cxrodgers commented 5 years ago

In scipy v1.3, the scipy.misc.imread and scipy.misc.imresize functions are no longer available. These are used throughout this package, especially in loading data in pose_dataset.py.

There's an easy replacement for imread : imageio.imread

For imresize, there are several choices:

These differ slightly in their implementation details (e.g., type of interpolation, anti-aliasing filters). Any preferences for which would be best?

My feeling is that scipy.ndimage.zoom is the best because it doesn't require adding a dependency (skimage or PIL). Also, the function signature is the same as the old scipy.misc.imresize, so it's a drop-in replacement.

cxrodgers commented 5 years ago

Here is a commit in my own fork that demonstrates the change: https://github.com/cxrodgers/PoseTF/commit/f36d9f17a3fa784c98055ee5df49b4419a9a2b3f

I can turn this into a PR if people like this approach

DenisPolygalov commented 5 years ago

My feeling is that scipy.ndimage.zoom is the best because it doesn't require adding a dependency (skimage or PIL). Also, the function signature is the same as the old scipy.misc.imresize, so it's a drop-in replacement.

not quite correct. It does not have 'interp' keyword argument which is used in util/visualize.py But anyway, unfortunately this repository is abandoned as many others intended to have papers as outputs...

cxrodgers commented 5 years ago

I see. I don't use util/visualize.py so I didn't know about that.

Here is the code I'm currently using in pose_dataset.py. Perhaps it will be useful for others.

        # Resize the image
        if scale == 1:
            img = image
        else:
            # Zoom each color channel separately
            img = np.array([
                scipy.ndimage.zoom(image[:, :, channel], scale, mode='reflect')
                for channel in range(image.shape[2])])
            img = np.moveaxis(img, 0, -1)
pouryajafarzadeh commented 4 years ago

I solve it by uninstalling scipy, and: pip install scipy==1.21