Skip to main content

MLP-Mixer in Keras/Tensorflow

Project description

MLP-Mixer in Keras

This is a simple keras implementation of MLP-Mixer. MLP-Mixer is an almost exclusivly multi-layer perceptions approach to vision like tasks.

Install

$ pip install mlp-mixer-keras

Example usage

from mlp_mixer_keras import MlpMixerModel 
import numpy as np

(x_train, y_train), (x_test, y_test) = tf.keras.datasets.cifar10.load_data()
model = MlpMixerModel(input_shape=x_train.shape[1:],
                      num_classes=len(np.unique(y_train)), 
                      num_blocks=4, 
                      patch_size=8,
                      hidden_dim=32, 
                      tokens_mlp_dim=64,
                      channels_mlp_dim=128,
                      use_softmax=True)
model.compile(loss='sparse_categorical_crossentropy', metrics='acc')
model.fit(x_train, y_train, validation_data=(x_test, y_test))

References

MLP-Mixer: An all-MLP Architecture for Vision

Ilya Tolstikhin, Neil Houlsby, Alexander Kolesnikov, Lucas Beyer, Xiaohua Zhai, Thomas Unterthiner, Jessica Yung, Daniel Keysers, Jakob Uszkoreit, Mario Lucic, Alexey Dosovitskiy, MLP-Mixer: An all-MLP Architecture for Vision

@misc{tolstikhin2021mlpmixer,
      title={MLP-Mixer: An all-MLP Architecture for Vision}, 
      author={Ilya Tolstikhin and Neil Houlsby and Alexander Kolesnikov and Lucas Beyer and Xiaohua Zhai and Thomas Unterthiner and Jessica Yung and Daniel Keysers and Jakob Uszkoreit and Mario Lucic and Alexey Dosovitskiy},
      year={2021},
      eprint={2105.01601},
      archivePrefix={arXiv},
      primaryClass={cs.CV}
}

MLP-Mixer: An all-MLP Architecture for Vision (Machine Learning Research Paper Explained)

Excellent Yannic Kilcher explainer video.

MLP Mixer - Pytorch

A pytorch implementation of MLP-Mixer. This repo helped a alot as I learned the ways of making a nice github repo for a project.

Phil Wang - lucidrains

MLP Mixer - Pytorch

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mlp-mixer-keras-0.0.5.tar.gz (4.4 kB view details)

Uploaded Source

File details

Details for the file mlp-mixer-keras-0.0.5.tar.gz.

File metadata

  • Download URL: mlp-mixer-keras-0.0.5.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.10

File hashes

Hashes for mlp-mixer-keras-0.0.5.tar.gz
Algorithm Hash digest
SHA256 ac02cf51c95105440f594304c3d4dfea71b725455ecf9764437d8e7300d5cfdd
MD5 d126504ae6a3716030cd79c0fdabb571
BLAKE2b-256 4388bd2f0a5d12ba8f3e465c015b2aca86783d2d16e708491c575bc7ab35b127

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page