Coder Social home page Coder Social logo

felixmohr / deep-learning-with-python Goto Github PK

View Code? Open in Web Editor NEW
139.0 14.0 107.0 11 KB

Example projects I completed to understand Deep Learning techniques with Tensorflow. Please note that I do no longer maintain this repository.

Jupyter Notebook 100.00%
dcgan vae lstm deep-learning python3 style-transfer tensorflow tensorflow-tutorials gan generative-adversarial-network

deep-learning-with-python's Introduction

Deep Learning with Python

Here I will put some projects that I create while learning how to apply deep neural networks. Current projects:

  • Variational Autoencoder for creating MNIST characters (notebook with explanations)
  • Deep Convolutional Generative Adversarial Network (DCGAN) for the same purpose (notebook with explanations)
  • DCGAN for creating human faces
  • Style Transfer

deep-learning-with-python's People

Contributors

felixmohr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

deep-learning-with-python's Issues

Error while reshaping the tensor in one of CNN layers.


InvalidArgumentError Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py in _do_call(self, fn, *args)
1333 try:
-> 1334 return fn(*args)
1335 except errors.OpError as e:

/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py in _run_fn(feed_dict, fetch_list, target_list, options, run_metadata)
1318 return self._call_tf_sessionrun(
-> 1319 options, feed_dict, fetch_list, target_list, run_metadata)
1320

/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py in _call_tf_sessionrun(self, options, feed_dict, fetch_list, target_list, run_metadata)
1406 self._session, options, feed_dict, fetch_list, target_list,
-> 1407 run_metadata)
1408

InvalidArgumentError: Input to reshape is a tensor with 3200 values, but the requested shape requires a multiple of 49
[[{{node decoder/Reshape}}]]

During handling of the above exception, another exception occurred:

InvalidArgumentError Traceback (most recent call last)
in ()
75 for i in range(30000):
76 batch = [np.reshape(b, [28, 28]) for b in mnist.train.next_batch(batch_size=batch_size)[0]]
---> 77 sess.run(optimizer, feed_dict = {X_in: batch, Y: batch, keep_prob: 0.8})
78
79 if not i % 200:

/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py in run(self, fetches, feed_dict, options, run_metadata)
927 try:
928 result = self._run(None, fetches, feed_dict, options_ptr,
--> 929 run_metadata_ptr)
930 if run_metadata:
931 proto_data = tf_session.TF_GetBuffer(run_metadata_ptr)

/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py in _run(self, handle, fetches, feed_dict, options, run_metadata)
1150 if final_fetches or final_targets or (handle and feed_dict_tensor):
1151 results = self._do_run(handle, final_targets, final_fetches,
-> 1152 feed_dict_tensor, options, run_metadata)
1153 else:
1154 results = []

/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py in _do_run(self, handle, target_list, fetch_list, feed_dict, options, run_metadata)
1326 if handle is None:
1327 return self._do_call(_run_fn, feeds, fetches, targets, options,
-> 1328 run_metadata)
1329 else:
1330 return self._do_call(_prun_fn, handle, feeds, fetches)

/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py in _do_call(self, fn, *args)
1346 pass
1347 message = error_interpolation.interpolate(message, self._graph)
-> 1348 raise type(e)(node_def, op, message)
1349
1350 def _extend_graph(self):

InvalidArgumentError: Input to reshape is a tensor with 3200 values, but the requested shape requires a multiple of 49
[[node decoder/Reshape (defined at :52) ]]

Caused by op 'decoder/Reshape', defined at:
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.6/dist-packages/ipykernel_launcher.py", line 16, in
app.launch_new_instance()
File "/usr/local/lib/python3.6/dist-packages/traitlets/config/application.py", line 658, in launch_instance
app.start()
File "/usr/local/lib/python3.6/dist-packages/ipykernel/kernelapp.py", line 477, in start
ioloop.IOLoop.instance().start()
File "/usr/local/lib/python3.6/dist-packages/tornado/ioloop.py", line 888, in start
handler_func(fd_obj, events)
File "/usr/local/lib/python3.6/dist-packages/tornado/stack_context.py", line 277, in null_wrapper
return fn(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/zmq/eventloop/zmqstream.py", line 450, in _handle_events
self._handle_recv()
File "/usr/local/lib/python3.6/dist-packages/zmq/eventloop/zmqstream.py", line 480, in _handle_recv
self._run_callback(callback, msg)
File "/usr/local/lib/python3.6/dist-packages/zmq/eventloop/zmqstream.py", line 432, in _run_callback
callback(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/tornado/stack_context.py", line 277, in null_wrapper
return fn(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/ipykernel/kernelbase.py", line 283, in dispatcher
return self.dispatch_shell(stream, msg)
File "/usr/local/lib/python3.6/dist-packages/ipykernel/kernelbase.py", line 235, in dispatch_shell
handler(stream, idents, msg)
File "/usr/local/lib/python3.6/dist-packages/ipykernel/kernelbase.py", line 399, in execute_request
user_expressions, allow_stdin)
File "/usr/local/lib/python3.6/dist-packages/ipykernel/ipkernel.py", line 196, in do_execute
res = shell.run_cell(code, store_history=store_history, silent=silent)
File "/usr/local/lib/python3.6/dist-packages/ipykernel/zmqshell.py", line 533, in run_cell
return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/IPython/core/interactiveshell.py", line 2718, in run_cell
interactivity=interactivity, compiler=compiler, result=result)
File "/usr/local/lib/python3.6/dist-packages/IPython/core/interactiveshell.py", line 2822, in run_ast_nodes
if self.run_code(code, result):
File "/usr/local/lib/python3.6/dist-packages/IPython/core/interactiveshell.py", line 2882, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 65, in
dec = decoder(sampled, keep_prob)
File "", line 52, in decoder
x = tf.reshape(x, reshaped_dim)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/gen_array_ops.py", line 7179, in reshape
"Reshape", tensor=tensor, shape=shape, name=name)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/op_def_library.py", line 788, in _apply_op_helper
op_def=op_def)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/util/deprecation.py", line 507, in new_func
return func(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/ops.py", line 3300, in create_op
op_def=op_def)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/ops.py", line 1801, in init
self._traceback = tf_stack.extract_stack()

InvalidArgumentError (see above for traceback): Input to reshape is a tensor with 3200 values, but the requested shape requires a multiple of 49
[[node decoder/Reshape (defined at :52) ]]

dst_loss not defined

in VAE.ipynb, dst_loss is not defined. based on your write up, i think you were tracking latent_loss...

How to generate 200*200 pxl face images?

Hi, Iam trying to run youre code on LFW also,I want to generate images with 200*200 pxl..
I change values where were 40 pxl to 200 but Iam getting thiss error :

InvalidArgumentError
Input to reshape is a tensor with 307200 values, but the requested shape requires a multiple of 120000

how is possible to generate 200 pxl pictures? Can you help,where we need to make changes?

"Ambiguous dimension: 24.5" in decoder call

I'm trying to run the VAE example by copying and pasting the code into a .py file. I'm getting the error below when I try to run it. Unfortunately I'm a python newbie and don't know what's going on. Any help is appreciated!

In [64]: dec = decoder(sampled, keep_prob)
Traceback (most recent call last):

File "", line 1, in
dec = decoder(sampled, keep_prob)

File "", line 60, in decoder
x = tf.layers.dense(sampled_z, units=inputs_decoder, activation=lrelu)

File "/Users/Mercy/anaconda3/lib/python3.6/site-packages/tensorflow/python/layers/core.py", line 215, in dense
return layer.apply(inputs)

File "/Users/Mercy/anaconda3/lib/python3.6/site-packages/tensorflow/python/layers/base.py", line 492, in apply
return self.call(inputs, *args, **kwargs)

File "/Users/Mercy/anaconda3/lib/python3.6/site-packages/tensorflow/python/layers/base.py", line 434, in call
self.build(input_shapes[0])

File "/Users/Mercy/anaconda3/lib/python3.6/site-packages/tensorflow/python/layers/core.py", line 118, in build
trainable=True)

File "/Users/Mercy/anaconda3/lib/python3.6/site-packages/tensorflow/python/layers/base.py", line 374, in add_variable
trainable=trainable and self.trainable)

File "/Users/Mercy/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/variable_scope.py", line 1065, in get_variable
use_resource=use_resource, custom_getter=custom_getter)

File "/Users/Mercy/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/variable_scope.py", line 962, in get_variable
use_resource=use_resource, custom_getter=custom_getter)

File "/Users/Mercy/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/variable_scope.py", line 367, in get_variable
validate_shape=validate_shape, use_resource=use_resource)

File "/Users/Mercy/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/variable_scope.py", line 352, in _true_getter
use_resource=use_resource)

File "/Users/Mercy/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/variable_scope.py", line 653, in _get_single_variable
shape = tensor_shape.as_shape(shape)

File "/Users/Mercy/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/tensor_shape.py", line 798, in as_shape
return TensorShape(shape)

File "/Users/Mercy/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/tensor_shape.py", line 434, in init
self._dims = [as_dimension(d) for d in dims_iter]

File "/Users/Mercy/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/tensor_shape.py", line 434, in
self._dims = [as_dimension(d) for d in dims_iter]

File "/Users/Mercy/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/tensor_shape.py", line 376, in as_dimension
return Dimension(value)

File "/Users/Mercy/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/tensor_shape.py", line 35, in init
raise ValueError("Ambiguous dimension: %s" % value)

ValueError: Ambiguous dimension: 24.5

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.