Skip to content

Keras Implementation of Vision Transformer (An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale)

Notifications You must be signed in to change notification settings

tuvovan/Vision_Transformer_Keras

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vision Transformer

Vision Transformer teaser

Content

Getting Started

  • Clone the repository

Prerequisites

  • Tensorflow 2.2.0+
  • Tensorflow_addons
  • Python 3.6+
  • Keras 2.3.0
  • PIL
  • numpy
pip install -r requirements.txt

Running

Training

```
python train.py
```

Usage

Training

usage: train.py [-h] [--logdir LOGDIR] [--image-size IMAGE_SIZE]
                [--patch-size PATCH_SIZE] [--num-layers NUM_LAYERS]
                [--d-model D_MODEL] [--num-heads NUM_HEADS]
                [--mlp-dim MLP_DIM] [--lr LR] [--weight-decay WEIGHT_DECAY]
                [--batch-size BATCH_SIZE] [--epochs EPOCHS]
optional arguments: -h, --help                show this help message and exit
                    --log_dir                 folder to save weights
                    --image_size              size of input image
                    --patch_size              size of patch to encode
                    --num-layers              number of transformer
                    --d-model                 embedding dimension
                    --mlp-dim                 hidden layer dimension
                    --lr                      learning rate
                    --weight-decay            weight decay
                    --batch-size              batch size
                    --epochs                  epochs

License

This project is licensed under the MIT License - see the LICENSE file for details

References

[1] AN IMAGE IS WORTH 16X16 WORDS: TRANSFORMERS FOR IMAGE RECOGNITION AT SCALE - link

[2] Text classification with Transformer - link

Acknowledgments

  • This work is heavily based on Keras version of Transformer.
  • Any ideas on updating or misunderstanding, please send me an email: vovantu.hust@gmail.com
  • If you find this repo helpful, kindly give me a star.

About

Keras Implementation of Vision Transformer (An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages