packtpublishing / deep-learning-with-keras Goto Github PK
View Code? Open in Web Editor NEWCode repository for Deep Learning with Keras published by Packt
License: MIT License
Code repository for Deep Learning with Keras published by Packt
License: MIT License
Hello,
I have been reading the book to try to understand the GANS. I would like to try it (GANs) for classification.
I have been looking to this code :https://github.com/PacktPublishing/Deep-Learning-with-Keras/blob/master/Chapter04/example_gan_convolutional.py
To try to adapt it to a GAN with N+1 outputs being N the number of classes and +1 for the forge output.
Some things I dont understand on the example, like the output generation gan_targets(xtest.shape[0])
. ... How exactly can the GAN architecture test if the output is fake or not ?
And to adapt this example, to make a Semi-supervised learning for classification, how should we incorporate the output layer of 10 with soft max and construct the outputs align with the inputs (and generated -fake- inputs with label ) ?
I would be grateful if there was some example, based on this one, were we could see GANs performing classification ?
Thanks in advance,
Rui
Hi all!
I am trying to replicate the model of transfer_glove_embeddings.py. When I try to execute the model I gel the following error:
`---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
in ()
8 weights=[embedding_weights],
9 trainable=True))
---> 10 model.add(SpatialDropout1D(Dropout(0.2)))
11 model.add(Conv1D(filters=NUM_FILTERS, kernel_size=NUM_WORDS,
12 activation="relu"))
~/.virtualenvs/negative-scoring/lib/python3.6/site-packages/keras/legacy/interfaces.py in wrapper(*args, **kwargs)
89 warnings.warn('Update your ' + object_name + 90 '
call to the Keras 2 API: ' + signature, stacklevel=2)
---> 91 return func(*args, **kwargs)
92 wrapper._original_function = func
93 return wrapper
~/.virtualenvs/negative-scoring/lib/python3.6/site-packages/keras/layers/core.py in init(self, rate, **kwargs)
162 @interfaces.legacy_spatialdropout1d_support
163 def init(self, rate, **kwargs):
--> 164 super(SpatialDropout1D, self).init(rate, **kwargs)
165 self.input_spec = InputSpec(ndim=3)
166
~/.virtualenvs/negative-scoring/lib/python3.6/site-packages/keras/legacy/interfaces.py in wrapper(*args, **kwargs)
89 warnings.warn('Update your ' + object_name + 90 '
call to the Keras 2 API: ' + signature, stacklevel=2)
---> 91 return func(*args, **kwargs)
92 wrapper._original_function = func
93 return wrapper
~/.virtualenvs/negative-scoring/lib/python3.6/site-packages/keras/layers/core.py in init(self, rate, noise_shape, seed, **kwargs)
99 def init(self, rate, noise_shape=None, seed=None, **kwargs):
100 super(Dropout, self).init(**kwargs)
--> 101 self.rate = min(1., max(0., rate))
102 self.noise_shape = noise_shape
103 self.seed = seed
TypeError: '>' not supported between instances of 'Dropout' and 'float'`
Any ideas? thanks in advanced
Hi!
First of all, I would like to say that I'm enjoying the book a lot so far! Good job!
What I would like to know is:
2.how to load and re-use the model passing a random sentence.
Thank you in advance!
ipython-input-11-cde6afe50c78 in module()
5 ftrain=open(os.path.join(Data_dir,"training.txt"),'rb')
6 for line in ftrain:
----> 7 label, sentence = line.strip().split("\t")
8 words=nltk.word_tokenize(sentence.decode().lower())
9 if len(words)>maxlen:
I am using Python3.6
It seems there is an error on line which start with
So what we have here is a 3D tensor of 8-bit integers. More precisely, it's an array of 60,000 matrices of 28 x 8 integers.
This should be 28 X 28 integrers.
Thank you for your book, I made the first chapter in Chinese notes, the level is not high, welcome comments.
Chapter03/keras_LeNet.py
line 58: AttributeError: module 'keras.backend' has no attribute 'set_image_dim_ordering'
line 28: ValueError: Negative dimension size caused by subtracting 2 from 1 for 'max_pooling2d_1/MaxPool' (op: 'MaxPool') with input shapes: [?,
1,28,20].
Hi, authors,
In this line, it should be input_shape=(IMG_CHANNELS, IMG_ROWS, IMG_COLS)
as the CIFAR 10 is loaded in the shape (num, channels, rows, columns)
nothing
Hello, I download the dataset from Kaggle, but it does not work. seem your dataset is . binary?
how to download the book'data?
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.