Skip to content

Vistion Transformer with timm pretrain weight trasfer learning

Notifications You must be signed in to change notification settings

theerawatramchuen/classif_timm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Image Classification Using Vision transformer or other model in 'timm' pretrained weight model library

Image Classification Using Vision transformer or various other model with 'timm' pretrained weight

Steps to follow:

Installation:

Anaconda Python Environment
version is working for CPU or [GPU]
Python 3.8
torchvision 0.16.1 (pip3 install torchvision==0.16.1)
torch 2.1.1 or [torch 2.1.1+cu121] (https://pytorch.org/get-started/locally/)
timm (pip3 install timm)
scikit-learn
mathplotlib

Installation (optional for image classification API):

flask (pip3 install flask)
opencv-python (pip3 install opencv-python)

Setup for demo code on EBS dataset:

  1. Unzip image dataset under folder "classif_timm" folder
  2. Run "vit_ebs_timm_gpt-4-turbo.ipynb" for the model training, model weight saving and prediction sample images

Running training and inferencing with other pretrained weight model which listed in the 8th cell

  1. Open "timm_classif.ipynp" with Jupyter notebook
  2. Define dataset folder in the 2nd cell
  3. Define training hyper parameters in the 3rd cell
  4. Define Data augmentation and normalization for training in the 4th cell
  5. Define pretrained weight model in the 9th cell

Running demo API mode:

Make sure flask and opencv-python packages are installed in the python environment.

  1. Open new terminal and Run "python classif_api.py"
  2. Open new terminal and Run "python test_classif_api.py"

Reference:

https://timm.fast.ai/
https://github.com/huggingface/pytorch-image-models
https://youtu.be/mK0CHqLCoXA?si=UXKv2XkihnrjSp0O

About

Vistion Transformer with timm pretrain weight trasfer learning

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published