Skip to main content

A library for creating vision transformers for computer vision

Project description

transcv

transcv creates vision transformers for visual recognition which can be pre-trained using self-supervised learning

Acknowledgement

  1. Ross Wightman's repository for vision transformer
  2. Hugging Face
  3. DETR repository
  4. An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  5. fastai
  6. nbdev

Install

pip install transcv

Along with transcv, we also need fastai and nbdev. So, it is recommended to use :

pip install fastai nbdev transcv -q --upgrade

How to use

An example for using the VisRecTrans class for getting a custom ViT model :

from transcv.visrectrans import VisRecTrans
vis_rec_ob = VisRecTrans('vit_small_patch16_224', 10, False)
model = vis_rec_ob.create_model()
vis_rec_ob.initialize(model)
embed_callback = vis_rec_ob.get_callback()

Now, the model, along with the embed_callback, can be used with the Learner class, of fastai, and can be fine-tuned on any image classification dataset.

An example for using the SwinT class for building a Swin transformer model :

from transcv.swin import SwinT
swint_ob = SwinT('swin_base_patch4_window7_224', pretrained = False, num_classes = 10)
swin_model = swint_ob.get_model()
assert isinstance(swin_model, nn.Sequential)

Now, the swin_model can be used with the Learner class, of fastai, and can be fine-tuned on any dataset for visual recognition task.

For a detailed description of the classes and methods, please refer to the documentation.

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

transcv-0.0.5.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

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

transcv-0.0.5-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file transcv-0.0.5.tar.gz.

File metadata

  • Download URL: transcv-0.0.5.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.10

File hashes

Hashes for transcv-0.0.5.tar.gz
Algorithm Hash digest
SHA256 40cc934a65c56edb6b1adc2bc4bad5500109f515a7d43bd81d15d910769f764c
MD5 35dd7d95dac6d04d5a34f63093a66fa7
BLAKE2b-256 329e048c019951d7f5c5cca1a5cf16a4781b64aee912e0cae006746e9ad4999c

See more details on using hashes here.

File details

Details for the file transcv-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: transcv-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 11.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.10

File hashes

Hashes for transcv-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 ddd2e844ca97667a7f904658e7736618621a4d593eefae88c63589cf3ee5d873
MD5 32d891f6bddca30dd8337d1cf43fdb1f
BLAKE2b-256 71cd8c21161756d10c3472c7848f40fff32256b5b1289162dee0b071c66f8c36

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