Comments (1)
Hi,
Input dimension on an LTC is (batch size, sequence length, input features).
(10000, 1, 384, 640, 3) would run the RNN for 1 timestep, i.e., a single image, whereas (10000, 6, 384, 640, 3) for 6 timestep, i.e.,a video.
Keep in mind that LTC does not support multi-dimensional inputs, i.e, you need to apply a flattening or pooling to make the input a 1D input vector. If you have image data, which sounds like in your case, I suggest applying a few convolutional layers before
height, width, channels = (384, 640, 3)
model = keras.models.Sequential(
[
keras.layers.InputLayer(input_shape=(None, height, width, channels)),
keras.layers.TimeDistributed(
keras.layers.Conv2D(32, (5, 5), activation="relu")
),
keras.layers.TimeDistributed(keras.layers.MaxPool2D()),
keras.layers.TimeDistributed(
keras.layers.Conv2D(64, (5, 5), activation="relu")
),
keras.layers.TimeDistributed(keras.layers.MaxPool2D()),
keras.layers.TimeDistributed(keras.layers.Flatten()),
keras.layers.TimeDistributed(keras.layers.Dense(32, activation="relu")),
keras.layers.RNN(ncp_cell, return_sequences=True),
keras.layers.TimeDistributed(keras.layers.Activation("softmax")),
]
)
model.compile(
optimizer=keras.optimizers.Adam(0.01),
loss='sparse_categorical_crossentropy',
)
The data should now be of shape (10000,6,384, 640, 3)
If you need to make one prediction per video, then set return_sequences=False
and remove the last TimeDistributed
. If you need a prediction at each frame, then let return_sequences=True
.
from ncps.
Related Issues (20)
- Evaluate model HOT 1
- 200GB data :)
- In file: ltc_example_sinusoidal.ipynb: error NameError: name 'wirings' is not defined HOT 1
- Reproducibility issue: low rewards in Atari examples HOT 4
- why [-1, 1, 1]? HOT 2
- TypeError: SequenceLearner.optimizer_step() missing 1 required positional argument: 'closure' HOT 1
- Example of stacking LTC with convolutional layers on pytorch version HOT 2
- Inquiry on LTC Models for Financial Time-Series Prediction HOT 2
- Issues on recurrent connections in command layer for CfC
- getting issues while saving model HOT 2
- Input dimension HOT 1
- LtC and CfC implementation questions
- Pytorch model behaves differently after saving HOT 1
- How to define Output Dimension in NCP/LTC network?
- Example for image sequence classifier HOT 3
- Defining equal input and output shapes for LTC HOT 1
- Python gives anRuntime error when I try to send hidden state (hx) to the CfC model. HOT 2
- way to get 200G dataset
- What dependency versions? HOT 4
- module 'tensorflow.keras.layers' has no attribute 'AbstractRNNCell' HOT 2
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 ncps.