• Stars
    star
    500
  • Rank 87,546 (Top 2 %)
  • Language
    Python
  • License
    MIT License
  • Created almost 4 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Let's train vision transformers (ViT) for cifar 10!

vision-transformers-cifar10

This is your go-to playground for training Vision Transformers (ViT) and its related models on CIFAR-10, a common benchmark dataset in computer vision.

The whole codebase is implemented in Pytorch, which makes it easier for you to tweak and experiment. Over the months, we've made several notable updates including adding different models like ConvMixer, CaiT, ViT-small, SwinTransformers, and MLP mixer. We've also adapted the default training settings for ViT to fit better with the CIFAR-10 dataset.

Using the repository is straightforward - all you need to do is run the train_cifar10.py script with different arguments, depending on the model and training parameters you'd like to use.

Updates

  • Added ConvMixer implementation. Really simple! (2021/10)

  • Added wandb train log to reproduce results. (2022/3)

  • Added CaiT and ViT-small. (2022/3)

  • Added SwinTransformers. (2022/3)

  • Added MLP mixer. (2022/6)

  • Changed default training settings for ViT.

Usage example

python train_cifar10.py # vit-patchsize-4

python train_cifar10.py --size 48 # vit-patchsize-4-imsize-48

python train_cifar10.py --patch 2 # vit-patchsize-2

python train_cifar10.py --net vit_small --n_epochs 400 # vit-small

python train_cifar10.py --net vit_timm # train with pretrained vit

python train_cifar10.py --net convmixer --n_epochs 400 # train with convmixer

python train_cifar10.py --net mlpmixer --n_epochs 500 --lr 1e-3

python train_cifar10.py --net cait --n_epochs 200 # train with cait

python train_cifar10.py --net swin --n_epochs 400 # train with SwinTransformers

python train_cifar10.py --net res18 # resnet18+randaug

Results..

Accuracy Train Log
ViT patch=2 80%
ViT patch=4 Epoch@200 80% Log
ViT patch=4 Epoch@500 88% Log
ViT patch=8 30%
ViT small 80%
MLP mixer 88%
CaiT 80%
Swin-t 90%
ViT small (timm transfer) 97.5%
ViT base (timm transfer) 98.5%
ConvMixerTiny(no pretrain) 96.3% Log
resnet18 93%
resnet18+randaug 95% Log

Used in..

More Repositories

1

Kaggle-PANDA-1st-place-solution

1st place solution for the Kaggle PANDA Challenge
Jupyter Notebook
105
star
2

apple-lidar-stream

Stream Apple LiDAR (iPad/iPhone) data with open3d
Python
76
star
3

efficientdet.pytorch

:neckbeard:Unofficial implementation of EfficientDet
Jupyter Notebook
61
star
4

benchmark-FP32-FP16-INT8-with-TensorRT

Benchmark inference speed of CNNs with various quantization methods in Pytorch+TensorRT with Jetson Nano/Xavier
Jupyter Notebook
54
star
5

timm_speed_benchmark

Benchmark Benchmark Benchmark!
Jupyter Notebook
51
star
6

BlazeFace_Person.pytorch

Unofficial Pytorch implementation of 🔥BlazeFace🔥
Jupyter Notebook
42
star
7

ODA-Object-Detection-ttA

ODA is a test-time-augmentation(TTA) tool for 2D object detectors. For use in Kaggle competitions.
Jupyter Notebook
37
star
8

Deep-Compression.Pytorch

Unofficial Pytorch implementation of Deep Compression in CIFAR10
Python
33
star
9

DatasetCulling

✂️ Dataset Culling: Faster training of domain specific models with distillation ✂️ (IEEE ICIP 2019)
Python
27
star
10

pytorch-mgpu-cifar10

testing multi gpu for pytorch
Python
25
star
11

MetricLearning-mnist-pytorch

Playground of Metric Learning with MNIST @pytorch. We provide ArcFace, CosFace, SphereFace, CircleLoss and visualization.
Jupyter Notebook
24
star
12

faster-rcnn.pytorch_resnet50

Pytorch Pretrained Resnet18, 34, 50 backbone of faster-rcnn
Python
17
star
13

pytorch-onnx-tensorrt-CIFAR10

Train cifar10 networks and inference with tensorrt.
Python
14
star
14

pytorch-cifar10-fp16

Let's train CIFAR 10 Pytorch with Half-Precision!
Python
13
star
15

keras-Opcounter

calculate number of OPS (computation) in a Keras model!
Python
12
star
16

youtube-stream-downloader

Download Youtube, Twitch, whatever videos with a Python script.
Python
11
star
17

easy-anomaly-detection-with-keras

Lets do anomaly detection with keras!
Python
11
star
18

AnomalyDetection.pytorch

Startup some anomaly detection with pytorch!
Python
9
star
19

kaggle-nflimpact-13thplace

Solution of team tara: Public 7th, Private 13th (The renewed pipeline scores 8th place)
Jupyter Notebook
9
star
20

SSD.objectdetection.pytorch

Library for training and testing object detection for Pytorch (ssd, retinanet)
Jupyter Notebook
8
star
21

ESC-50.pytorch

audio classification by pytorch.
Jupyter Notebook
7
star
22

centernet-from-scratch.pytorch

A simplifed and unofficial implementation of centernet
Jupyter Notebook
7
star
23

quantize_models_sandbox

quantize models like vit and mlp-mixer
Jupyter Notebook
5
star
24

training-domain-specific-models

Framework for training efficient domain specific object detection models in Pytorch
Python
4
star
25

arxiv-scraping

let's scrape arxiv papers by python
Python
3
star
26

kaggle-wheat-arutema47

Global Wheat Detection Codes. Private 80th silver.
Jupyter Notebook
3
star
27

keras_resnet_sparsity

calculate sparsity of resnet w/keras
Python
2
star
28

compare-efficientnet-and-resnet

Compare performance of efficientnet against resnet in pytorch
Jupyter Notebook
2
star
29

benchmark-mygpu-pytorch

benchmark my gpu, personal note
Jupyter Notebook
2
star
30

computation-calculator.pytorch

Calculate the number of computation (MACs) you need for a given CNN.
2
star
31

textsnake_pytorch

Unofficial implementation of textsnake. Mostly to practice code reading.
Jupyter Notebook
2
star
32

cifar10-challange-with-wandb

Python
2
star
33

my-phD-thesis

PhD thesis @Keio University 2019
TeX
1
star
34

line-notify-bot-with-apscheduler

Python
1
star
35

over-the-counter-faster-rcnn.pytorch

a easy to use faster-rcnn in pytorch
Python
1
star
36

deepsort.keras

DeepSort implemented in Keras.
1
star
37

Point-Cloud-Neural-Networks

Study works using point cloud+neural networks
1
star
38

pytorch-lightning-tryouts

try out pytorch lightning with CIFAR 10!
HTML
1
star
39

choka-analysis

釣りビジョンの釣果をスクレイピング→可視化
Python
1
star
40

quantize-huggingface

Quantize Huggingface transformers like BERT 🤗
Jupyter Notebook
1
star