Comments (8)
Yes, and they would be implemented as such. They would be wrappers around the 2D operations, exposing them for 1D use cases in a user-friendly way.
The API for Convolution1D would be slightly simpler than that of Convolution2D. nb_row, nb_col would be replaced a unique parameter, like filter_length. I imagine image_shape would be superfluous.
from keras.
If i didn't got them wrong there are two types of 1D convolution possible for sequences.
One is the one used in the paper:
Natural Language Processing (almost) from Scratch by Collobert and Weston.
that is implemented as temporal convolution in Torch7
Another one that seams slightly different is the one used in :
A Convolutional Neural Network for Modelling Sentences by Nal Kalchbrenner
The two are different since in the first case we have k filters (where k is the eight of the output matrix) of dimension NxM where n is dimension of the convolution window and m is the number of features of the input sequence. the second one has M filters of Nx1 (vectors) instead that convolve independently over the features of the input sequence.
Should both be added? or do you mind to add one of them in particular?
from keras.
Both can certainly be useful and would probably need to be added, in a way that makes their use cases perfectly clear. It would also be neat to have reimplementations of these works as examples...
I am wondering whether having separate classes for spatial convolution and temporal convolution, like in Torch7, would be a simpler, more user-friendly API. Any thoughts on that?
from keras.
I've implemented the parts of the Kalchbrenner Modelling Sentences paper and had them working outside of keras. I started to add it to keras here https://github.com/fchollet/keras/blob/73b587e3c3ad218deedfdc94c19ceed3b7632925/keras/layers/convolutional.py
Haven't had a chance to test yet, but was planning to also write up some examples.
from keras.
@jef5ez: sounds very cool. It would definitely be interesting to see some live examples!
from keras.
@dbonadiman to me it sounds like the second case is simply a special form of the first case, with M=1?
I don't think having an API for both is necessary. The constructor for a Convolution1D layer could take 3 arguments, n_filters, filter_length and n_channels. With n_filters and filter_length being mandatory, and n_channels as a keyword argument defaulting to 1. That would give us the second case from @dbonadiman's example by default, and the first case when explicitly required.
@fchollet what is the difference between spatial and temporal convolution in torch?
from keras.
@jef5ez Thank you for your contribution to extend CNN to language models.
Could I have any examples about it ?
i.e. apply it on IMDB data, to label positive and negative reviews.
Thx.
from keras.
@sjhddh unfortunately I got busy with other things and never finished working on it. My code assumed the rows/columns of the embeddings were flipped from how keras stores them. That branch is now also several hundred commits behind master and I don't know how much else has changed about keras...
from keras.
Related Issues (20)
- Compatible with .ogg format HOT 2
- keras autocast casts numpy int types to float HOT 2
- bug in TF _keepdims? HOT 3
- keras.ops.cross doesn't propagate input sizes HOT 1
- GSOC '24 Project? HOT 1
- Dice loss - incorrect HOT 1
- The loss becomes neagative from positive values dring taining loop HOT 3
- Unusual behavior of `predict` for JAX backend HOT 17
- Layernorm not supporting axis [-2, 3] HOT 2
- LSTM layer with dropout does not use fast CuDNN implementation in Keras 3 HOT 1
- RaggedTensor HOT 4
- [Proposal] API tuning for use_cudnn in LSTM/other layers HOT 5
- The torch backend for jnp.cholesky should use torch.linalg.cholesky, not torch.cholesky HOT 1
- Numeric diff of BatchNormalization layer when migrate from Keras2 to keras3 HOT 5
- How to save Scikit-Learn-Keras Model into a Persistence File (pickle/hd5/json/yaml) with Keras 3 HOT 12
- loss and val_loss decreasing HOT 1
- StringLookup does not return expected dtype for multi_hot
- TypeError: Could not locate class 'adam'. Make sure custom classes are decorated with `@keras.saving.register_keras_serializable()` HOT 1
- Shape error for some use cases of `binary_crossentropy`. HOT 2
- ops.copy makes object (arrays only?) immutable HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from keras.