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

[Bug] TypeError: 'str' object is not callable, when unnormalize with customize mean and std #4

Closed
genghisun opened this issue Jul 2, 2022 · 1 comment · Fixed by #5
Labels
bug Something isn't working

Comments

@genghisun
Copy link
Contributor

torchshow.set_image_mean([0., 0., 0.])
torchshow.set_image_std([1., 1., 1.])
torchshow.show(img)


---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)

File /somepath/python3.8/site-packages/torchshow/visualization.py:289, in vis_image(x, unnormalize, **kwargs)
    [287]     if user_std == None:
    [288]         user_std = [1.] * x.shape[-1] # Initialize std to 1 if not specified.
--> [289]     x = unnormalize(x, user_mean, user_std)
    [291] elif unnormalize=='auto':
    [292]     x = auto_unnormalize_image(x)

TypeError: 'str' object is not callable

It seems to be caused by the variable name and method name being the same 'unnormalize'.
And this case should be added to the test.

@xwying xwying added the bug Something isn't working label Jul 2, 2022
@xwying xwying linked a pull request Jul 2, 2022 that will close this issue
3 tasks
@xwying
Copy link
Owner

xwying commented Jul 2, 2022

Thank you for spotting this bug! I really forgot this function since I barely use it myself.

@xwying xwying closed this as completed in #5 Jul 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants