Comments (4)
The issue exists here,
PyTorch-Deep-Dream/deep_dream.py
Line 92 in 637de95
Try normalising the dreamed_image
in range of [0,1] and then saving it. Replace L92 with,
plt.imsave(f"outputs/output_{filename}", norm(dreamed_image))
def norm(x):
return np.array((x - np.min(x)) / (np.max(x) - np.min(x)))
from pytorch-deep-dream.
Interesting... I also get an error but differnt message:
Traceback (most recent call last): File "deep_dream.py", line 97, in <module> plt.imsave(f"outputs/output_{filename}", dreamed_image) File "C:\Users\dougl\anaconda3\envs\pytorchdeepdream\lib\site-packages\matplotlib\pyplot.py", line 2140, in imsave return matplotlib.image.imsave(fname, arr, **kwargs) File "C:\Users\dougl\anaconda3\envs\pytorchdeepdream\lib\site-packages\matplotlib\image.py", line 1496, in imsave rgba = sm.to_rgba(arr, bytes=True) File "C:\Users\dougl\anaconda3\envs\pytorchdeepdream\lib\site-packages\matplotlib\cm.py", line 271, in to_rgba raise ValueError("Floating point image RGB values " ValueError: Floating point image RGB values must be in the 0..1 range.
from pytorch-deep-dream.
Interesting... I also get an error but differnt message:
Traceback (most recent call last): File "deep_dream.py", line 97, in <module> plt.imsave(f"outputs/output_{filename}", dreamed_image) File "C:\Users\dougl\anaconda3\envs\pytorchdeepdream\lib\site-packages\matplotlib\pyplot.py", line 2140, in imsave return matplotlib.image.imsave(fname, arr, **kwargs) File "C:\Users\dougl\anaconda3\envs\pytorchdeepdream\lib\site-packages\matplotlib\image.py", line 1496, in imsave rgba = sm.to_rgba(arr, bytes=True) File "C:\Users\dougl\anaconda3\envs\pytorchdeepdream\lib\site-packages\matplotlib\cm.py", line 271, in to_rgba raise ValueError("Floating point image RGB values " ValueError: Floating point image RGB values must be in the 0..1 range.
I get the same error when running on Google Colab with CUDA Version: 10.1:
Dreaming: 100% 10/10 [00:16<00:00, 1.61s/it] Clipping input data to the valid range for imshow with RGB data ([0..1] for floats or [0..255] for integers). Traceback (most recent call last): File "deep_dream.py", line 92, in <module> plt.imsave(f"outputs/output_{filename}", dreamed_image) File "/usr/local/lib/python3.6/dist-packages/matplotlib/pyplot.py", line 2066, in imsave return matplotlib.image.imsave(fname, arr, **kwargs) File "/usr/local/lib/python3.6/dist-packages/matplotlib/image.py", line 1550, in imsave rgba = sm.to_rgba(arr, bytes=True) File "/usr/local/lib/python3.6/dist-packages/matplotlib/cm.py", line 226, in to_rgba raise ValueError("Floating point image RGB values " ValueError: Floating point image RGB values must be in the 0..1 range.
from pytorch-deep-dream.
Interesting... I also get an error but differnt message:
Traceback (most recent call last): File "deep_dream.py", line 97, in <module> plt.imsave(f"outputs/output_{filename}", dreamed_image) File "C:\Users\dougl\anaconda3\envs\pytorchdeepdream\lib\site-packages\matplotlib\pyplot.py", line 2140, in imsave return matplotlib.image.imsave(fname, arr, **kwargs) File "C:\Users\dougl\anaconda3\envs\pytorchdeepdream\lib\site-packages\matplotlib\image.py", line 1496, in imsave rgba = sm.to_rgba(arr, bytes=True) File "C:\Users\dougl\anaconda3\envs\pytorchdeepdream\lib\site-packages\matplotlib\cm.py", line 271, in to_rgba raise ValueError("Floating point image RGB values " ValueError: Floating point image RGB values must be in the 0..1 range.
Same issue. The problem is here:
def deprocess(image_np):
image_np = image_np.squeeze().transpose(1, 2, 0)
image_np = image_np * std.reshape((1, 1, 3)) + mean.reshape((1, 1, 3))
image_np = np.clip(image_np, 0.0, 255.0) # Issue is here at this range of!
return image_np
Update the range passed to this function to:
image_np = np.clip(image_np, 0.0, 255.0)
Here is the suggested update to fix the issue:
def deprocess(image_np):
image_np = image_np.squeeze().transpose(1, 2, 0)
image_np = image_np * std.reshape((1, 1, 3)) + mean.reshape((1, 1, 3))
image_np = np.clip(image_np, 0.0, 1.0) # Adjusted to clip between 0 and 1
return image_np
from pytorch-deep-dream.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pytorch-deep-dream.