# TokenLearner: What Can 8 Learned Tokens Do for Images and Videos?

**URL:** <https://discuss.ai.google.dev/t/tokenlearner-what-can-8-learned-tokens-do-for-images-and-videos/28238>\
**Category:** Show and Tell\
**Tags:** education, keras\
**Created:** [December 17, 2021, 2:27am UTC](https://discuss.ai.google.dev/t/tokenlearner-what-can-8-learned-tokens-do-for-images-and-videos/28238 "2021-12-17T02:27:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ariG23498](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/arig23498/32/10854_2.png) [@ariG23498](https://discuss.ai.google.dev/u/ariG23498)\
**Post date:** [December 17, 2021, 2:27am UTC](https://discuss.ai.google.dev/t/tokenlearner-what-can-8-learned-tokens-do-for-images-and-videos/28238/1 "2021-12-17T02:27:12Z")

</div>

In a [ViT](https://arxiv.org/abs/2010.11929) setup, dividing an image of (256, 256) into patches of (8, 8) gets you 1024 patches to deal with.

In our (w/ @Sayak_Paul) new [keras example](https://keras.io/examples/vision/token_learner/) we implement [Adaptive Space-Time Tokenization for Videos](https://openreview.net/forum?id=z-l1kpDXs88) by Ryoo et. al. that helps reduce token count from 1024 to 8.

![GIF](https://d3qe71uytubmmx.cloudfront.net/original/2X/4/49e9f7567334c65bf0feb53b4f094db2ca173a53.gif)

What makes it even more interesting is that there is **no** performance drop with reducing the number of tokens. The paper (and we in the example) report lesser FLOPs accompanying boost in downstream results.

 ![image](https://d3qe71uytubmmx.cloudfront.net/original/2X/d/d2930555bd5e787d76a211a590dad9df04a3e469.png)
