Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update timeseries_classification_transformer tutorial with good accuracy #2006

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mehtamansi29
Copy link
Collaborator

timeseries_classification_transformer model creation data_format="channels_last" is giving less model parameters and degrades accuracy. Update example with data_format="channels_first". Fixes #20627


x = layers.GlobalAveragePooling1D(data_format="channels_last")(x)
print(f"Transformer Encoder: {x}")
x = layers.GlobalAveragePooling1D(data_format="channels_first")(x)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is incorrect unfortunately? We should be pooling on the time dimension.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fchollet - As per code example earlier data_format="channels_last" reduces the model parameter and accuracy degradation on GPU in latest keras. data_format="channels_first" in pooling also reduce the number of time steps in same GPU environment and get good accuracy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GlobalAveragePooling1D data_format Question
3 participants