Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

skimage >= 0.16, rescale need to set multichannel=True #154

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

pureexe
Copy link

@pureexe pureexe commented Oct 18, 2019

In skimage >= 0.16, When use skimage.transform.rescale need to set parameter multichannel=True to rescale the image
if it isn't set it will crash when input image larger than 1000 pixel in width or height because output of rescale will be 1 channel instead of 3 channels.

To reproduce bug:

  1. set environment which is install skimage version 0.16 or newer.
  2. input this image to demo.py with --isDlib=True
  3. boom!

Tracekback from my PC.

Traceback (most recent call last):
  File "demo.py", line 168, in <module>
    main(parser.parse_args())
  File "demo.py", line 56, in main
    pos = prn.process(image) # use dlib to detect face
  File "/home/pakkapon/PRNet/api.py", line 120, in process
    cropped_pos = self.net_forward(cropped_image)
  File "/home/pakkapon/PRNet/api.py", line 62, in net_forward
    return self.pos_predictor.predict(image)
  File "/home/pakkapon/PRNet/predictor.py", line 98, in predict
    feed_dict = {self.x: image[np.newaxis, :,:,:]})
  File "/home/pakkapon/.virtualenv/prnet/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 950, in run
    run_metadata_ptr)
  File "/home/pakkapon/.virtualenv/prnet/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1149, in _run
    str(subfeed_t.get_shape())))
ValueError: Cannot feed value of shape (1, 256, 256, 1) for Tensor 'Placeholder:0', which has shape '(?, 256, 256, 3)'

Best regrad
Pakkapon

In `skimage >= 0.16`, When use `skimage.transform.rescale` need to set parameter `multichannel=True` to rescale the image
if it isn't set it will crash when input image larger than 1000 pixel in width or height because output  of `rescale` will be 1 channel instead of 3 channels.
@ikalista
Copy link

ikalista commented Apr 4, 2021

REALLY helpful!
I was wondering why the number of channels of the image was reduced from 3 to 2 after the rescale()
image
and your suggestion works
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants