Giter Club home page Giter Club logo

replicating-vit's Introduction

Replicating-ViT

This Repository is an implementation of An Image is worth 16x16 words. A paper that came out in 2020 which used the highly successful transformer models from natural language processing for computer vision tasks. This implementation is purely in PyTorch.

Table of Contents

  • Getting Started
  • Usage
  • Module details

Getting Started

The ViT model would require an installation of PyTorch to run.

To clone this repository locally use the following command in the CLI:

!git clone https://github.com/p4arth/Replicating-ViT.git

Usage

Import the ViT (Vision Transformer) module which is under modules.vit.

from modules.vit import ViT
# Initializing the model
model = ViT()

Module details

The modules folder contains 5 submodules that altogether form the vision transformer model.

  • Patch Embeddings

    This module contains the patch embeddings class which is used in the paper to turn and image into patches of size 16x16. The patch embeddings are then flattened and passed onto the transformer encoder block.

  • Multi-Headed Self Attention (MSA)

    This module contains the multi-headed self attention block which resides inside the transformer encoder. The block applies a series of attention heads to the input provided.

  • Multi-Layer Perceptron (MLP)

    This module proceeds the multi-headed self attention block and contains a multi-layer perceptron, also called a dense layer.

  • Transformer Encoder

    This module combines both MSA and the MLP block to together form the transformer encoder layer. The input to this layer is flattened patches of an image which goes through a series of transformation in the MSA and MLP blocks.

  • ViT

    This module implements the Vision Transformer model.

replicating-vit's People

Contributors

p4arth avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.