danielvarga / keras-deep-dream Goto Github PK
View Code? Open in Web Editor NEWImplementing the full deep dream algorithm with octaves, on top of any model from https://github.com/fchollet/deep-learning-models
Implementing the full deep dream algorithm with octaves, on top of any model from https://github.com/fchollet/deep-learning-models
Thanks for your great implementation. Do you have any thoughts on why DD in Keras produces such different results from the Caffe version?
Specifically, in the Caffe version, whole objects (dogs, birds, buildings) appear in images after a few epochs. They also retain their native colours (brown dogs, gold metal, etc). In contrast, the Keras version seems to produce random, rainbow coloured swirls.
I suspect this is related to the underlying Keras implementation, so perhaps @fchollet would have some insight too.
I can't seem to get this to work. I am running a VM Ubuntu with the latest keras and tensorflow CPU.
When I run it:
deeplearning@deep-learning-virtual-machine:~/Desktop$ python3 deep_dream.py vgg16 jesse.png dream
I get the following:
Using TensorFlow backend.
(1080, 1620, 4)
(900, 1350, 4)
(750, 1125, 4)
Starting octave 0 with dimensions 1125 x 750
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/common_shapes.py", line 671, in _call_cpp_shape_fn_impl
input_tensors_as_shapes, status)
File "/usr/lib/python3.5/contextlib.py", line 66, in exit
next(self.gen)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/errors_impl.py", line 466, in raise_exception_on_not_ok_status
pywrap_tensorflow.TF_GetCode(status))
tensorflow.python.framework.errors_impl.InvalidArgumentError: Negative dimension size caused by subtracting 2 from 1 for 'block2_pool/MaxPool' (op: 'MaxPool') with input shapes: [?,1,375,128].
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "deep_dream.py", line 198, in
model = vgg16.VGG16(include_top=False, input_tensor=dream)
File "/home/deeplearning/Desktop/deep_learning_models/vgg16.py", line 119, in VGG16
x = MaxPooling2D((2, 2), strides=(2, 2), name='block2_pool')(x)
File "/usr/local/lib/python3.5/dist-packages/keras/engine/topology.py", line 554, in call
output = self.call(inputs, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/keras/layers/pooling.py", line 154, in call
data_format=self.data_format)
File "/usr/local/lib/python3.5/dist-packages/keras/layers/pooling.py", line 217, in _pooling_function
pool_mode='max')
File "/usr/local/lib/python3.5/dist-packages/keras/backend/tensorflow_backend.py", line 3012, in pool2d
x = tf.nn.max_pool(x, pool_size, strides, padding=padding)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/ops/nn_ops.py", line 1793, in max_pool
name=name)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/ops/gen_nn_ops.py", line 1598, in _max_pool
data_format=data_format, name=name)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/op_def_library.py", line 763, in apply_op
op_def=op_def)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py", line 2329, in create_op
set_shapes_for_outputs(ret)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py", line 1717, in set_shapes_for_outputs
shapes = shape_func(op)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py", line 1667, in call_with_requiring
return call_cpp_shape_fn(op, require_shape_fn=True)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/common_shapes.py", line 610, in call_cpp_shape_fn
debug_python_shape_fn, require_shape_fn)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/common_shapes.py", line 676, in _call_cpp_shape_fn_impl
raise ValueError(err.message)
ValueError: Negative dimension size caused by subtracting 2 from 1 for 'block2_pool/MaxPool' (op: 'MaxPool') with input shapes: [?,1,375,128].
Am I doing something wrong?
This looks like great work, I might just be a noob.
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.