Wolfram Research

Function Repository Resource:

DeepDreamAlpha

Source Notebook

Render the image using the DeepDream-α algorithm

Contributed by: Aster Ctor  |  Aster Ctor (MoeNet)

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"24network activation depth
"StepSize"1step size of each pattern overlay iteration
TargetDevice"CPU"works same as NetChain
WorkingPrecision"Real32"works same as NetChain

Examples

Basic Examples (2) 

Start with an image:

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

Now process it with DeepDreamAlpha:

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

Scope (1) 

Use GPU acceleration:

In[3]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/0bd7790c-40a3-41f2-9597-6be79d6ec816"]
Out[3]=

Options (3) 

Depth (1) 

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/b7c60084-6fde-4cf8-b6d5-d12de8917f38"]
Out[4]=

StepSize (2) 

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/0910c7ec-a4d3-43fb-8109-35af413cc1c6"]
Out[5]=
In[6]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/7bbf59a7-484e-467d-bd0c-85d996438334"]
Out[6]=

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

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

Neat Examples (1) 

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

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

Resource History

Related Resources

License Information