An implementation of deepdream for mxnet
- Recommended Create a new Virtualenvironment
- Install MXNet in your venv (compile it by yourself, or use pip (
pip install mxnet
) - Install all other requirements with
pip install -r requirements.txt
- Profit
Assume you are having the following files:
- Inception-BN-0126.params (trained model)
- Inception-BN-symbol.json (network definition)
- You will need to rename
Inception-BN-symbol.json
toorig-Inception-BN-symbol.json
- Choose the layer you want to visualize by looking at the names of the
Convolutional
layers in the symbol definition file - Remember how many channels this layer has.
- Set all required values in the config file (
config.json
)input_shape
the shape of the input images in the formnum_channels, height, width
batch_size
the batch size to use while dreamingscale_n
the number of downscale steps for the laplacian gradient normalization (2^scale_n should be smaller than your image size)num_steps
number of optimization steps per octavenum_octaves
number of times the image shall be increased in sizeoctave_scale
how much the size should increasestep_size
step size for applying the gradient on the input iamgemax_tile_size
max size of each tile in pixels for saving GPU memorymean
RGB mean values that should be subtracted from the input image (not mandatory)
- Start the visualization with:
python deepdream.py <model-prefix> <epoch> <layer_name> <layer_id> -g <gpu_to_use> --all -c config.json --folder <place to save resulting images>
, with our example data:python deepdream.py Inception-BN 0126 conv_4d_double_3x3_1 140 --all -c config.json -g 0 --folder images/inception
- Profit again!
Feel free to open an issue.
I'm happy to review your Pull Request!