Skip to main content

Implementation of popular vision models in Jax

Project description

Equimo: Modern Vision Models in JAX/Equinox

WARNING: This is a research library implementing recent computer vision models. The implementations are based on paper descriptions and may not be exact replicas of the original implementations. Use with caution in production environments.

Equimo (Equinox Image Models) provides JAX/Equinox implementations of recent computer vision models, currently focusing (but not limited to) on transformer and state-space architectures.

Features

  • Pure JAX/Equinox implementations
  • Focus on recent architectures (2023-2024 papers)
  • Modular design for easy experimentation
  • Extensive documentation and type hints

Installation

From PyPI

pip install equimo

From Source

git clone https://github.com/clementpoiret/equimo.git
cd equimo
pip install -e .

Implemented Models

Model Paper Year Status
FasterViT FasterViT: Fast Vision Transformers with Hierarchical Attention 2023
Castling-ViT Castling-ViT: Compressing Self-Attention via Switching Towards Linear-Angular Attention During Vision Transformer Inference 2023 Partial*
MLLA Mamba-like Linear Attention 2024
PartialFormer Efficient Vision Transformers with Partial Attention 2024
SHViT SHViT: Single-Head Vision Transformer with Memory Efficient Macro Design 2024
VSSD VSSD: Vision Mamba with Non-Causal State Space Duality 2024

*: Only contains the Linear Angular Attention module. It is straight forward to build a ViT around it, but may require an additional __call__ kwarg to control the sparse_reg bool.

Basic Usage

import jax

import equimo.models as em

# Create a model (e.g. `faster_vit_0_224`)
key = jax.random.PRNGKey(0)
model = em.FasterViT(
    img_size=224,
    in_channels=3,
    dim=64,
    in_dim=64,
    depths=[2, 3, 6, 5],
    num_heads=[2, 4, 8, 16],
    hat=[False, False, True, False],
    window_size=[7, 7, 7, 7],
    ct_size=2,
    key=key,
)

# Generate random input
x = jax.random.normal(key, (3, 224, 224))

# Run inference
output = model(x, enable_dropout=False, key=key)

Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

License

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

Citation

If you use Equimo in your research, please cite:

@software{equimo2024,
  author = {Clément POIRET},
  title = {Equimo: Modern Vision Models in JAX/Equinox},
  year = {2024},
  publisher = {GitHub},
  url = {https://github.com/clementpoiret/equimo}
}

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

equimo-0.1.3a4.tar.gz (41.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

Equimo-0.1.3a4-py3-none-any.whl (57.2 kB view details)

Uploaded Python 3

File details

Details for the file equimo-0.1.3a4.tar.gz.

File metadata

  • Download URL: equimo-0.1.3a4.tar.gz
  • Upload date:
  • Size: 41.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.4.30

File hashes

Hashes for equimo-0.1.3a4.tar.gz
Algorithm Hash digest
SHA256 09f2a2da0dd7d4382c1695e239fe2bbf4e970a34f7529f6101f0372f478e4516
MD5 c2c1f1b9c34251db1f6745eb78c0667b
BLAKE2b-256 6aad1417afae9c2955d192f806747940b1cae386730393e9064c419f8a075d8f

See more details on using hashes here.

File details

Details for the file Equimo-0.1.3a4-py3-none-any.whl.

File metadata

  • Download URL: Equimo-0.1.3a4-py3-none-any.whl
  • Upload date:
  • Size: 57.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.4.30

File hashes

Hashes for Equimo-0.1.3a4-py3-none-any.whl
Algorithm Hash digest
SHA256 aced8febf1323e055588047da09095a49976375c59e801a3fbbbe6f39e6577cb
MD5 e7237d21c70f48a3dc15164f2ecba557
BLAKE2b-256 9f4be5818b5421131ce29d2eb2a4998f1b5a61a0d672ff1dc33e7ec0a7a903e3

See more details on using hashes here.

Supported by

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