Using PyTorch for deep dreaming
The aim of this project is to create some fun images and to help me improve in using the PyTorch library for machine learning tasks. Apart from that, I just like using convolutional neural networks in a creative manner.
In order to use the Deep-Dream Python script like any other CLI application, the following parameters can be specified ...
Argument | Explanation | Required? | Default |
---|---|---|---|
-h, --help | Displays the help message | β | - |
-b, --base-img | Specifies the path to the base image | βοΈ | - |
-d, --destination | Specifies the destination of the resulting image | β | - |
-n, --n-octaves | Defines the number of octaves used for the dream | β | 10 |
-s, --octave-scales | Defines the factor by which each octave should be scaled | β | 1.4 |
--lr | Defines the learning rate / step size | β | 0.01 |
--iters | Specifies the number of iterations per partial dream | β | 10 |
--layer-n | Defines the layer, whose activations should be maximized | β | 10 |
-v, --verbose | Flag; Should intermediate results be displayed? | β | False |
-i, --interval | Specifies the interval for displaying intermediate results | β | 5 |
Here are some of the final results: ...
Original | @conv3(layer=4) | @inception3b(layer=7) | @inception4b(layer=10) | @maxpool4(layer=14) |
---|---|---|---|---|
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Various dreams with different depths
I'm very glad about the end results. This was a slighter smaller project than usual, as there wasn't a lot of code to write and I finished quite quickly. However, I still appreciate me being able to learn new stuff about convolutional neural networks and different ways to visualize what their doing.
P.S.: I might add some new features to this project every now and then (whenever I have some spare time on my hands), as there are still some things that could be implemented: Guided Deep Dreams, etc.
- Original Google Deep-Dream repository
- Different PyTorch Deep-Dream implementation
- Pictures from Pixabay
... MattMoony (September, 2019)