Wolfram Research

Function Repository Resource:

DeepDreamAlpha

Source Notebook

Render the image using the DeepDream-α algorithm.

Contributed by: Aster Ctor

ResourceFunction["DeepDreamAlpha"][image]

renders image using the deepdream-α algorithm.

ResourceFunction["DeepDreamAlpha"][image,n]

renders image using n iterations.

Details and Options

ResourceFunction["DeepDreamAlpha"] has the following options:
"Depth" 24 network activation depth
"StepSize" 1 step size of each pattern overlay iteration
TargetDevice "CPU" works same as NetChain
WorkingPrecision "Real32" works same as NetChain

Examples

Basic Examples

Start with an image of a house:

In[1]:=
img = ExampleData[{"TestImage", "House"}]
Out[1]=

Show the result using DeepDreamAlpha:

In[2]:=
ResourceFunction["DeepDreamAlpha"][img, 9]
Out[2]=

Scope

One can use GPU acceleration:

In[3]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/9153c759-6850-46c5-9bac-335b44b9931c"]
Out[3]=

Options

“Depth”

The activation depth is an integer between 1 and 30. The default is to activate layer 24. Shallow layers tend to be fine textures, while deep layers tend to be abstract patterns:

In[4]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/92259a7c-16d4-42f2-bc36-8c886b737b70"]
Out[4]=

StepSize

The smaller the step size, the smoother the final result will be:

In[5]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/d7435a5b-5485-41d7-9eb1-b9c00aa874d6"]
Out[5]=
In[6]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/b68b6b53-e896-4684-876d-479753a88b75"]
Out[6]=

Note that due to the accumulation of errors, the results are completely different:

In[7]:=
move1 != move2
Out[7]=

Neat Examples

Render high-resolution images on the GPU and observe the effect:

In[8]:=
img = ExampleData[{"TestImage", "Lena"}];
ResourceFunction["DeepDreamAlpha"][img, 25, TargetDevice -> "GPU", "StepSize" -> 0.1]
Out[9]=

Resource History

Related Resources

License Information