Skip to content
This repository has been archived by the owner on Nov 27, 2022. It is now read-only.

Fine grained classification using progressive jigsaw learning. Implementation in Pytorch Lightning

Notifications You must be signed in to change notification settings

chophilip21/jigsaw_image_classification

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pytorch Lightning implementation of Jigsaw Patch Learning for Fine-grained image classification

Requirment

python 3.6

PyTorch >= 1.3.1

Pytorch lightning >= 1.10

torchvision >= 0.4.2

Instructions

  • You can download dataset from the official link: http://www.vision.caltech.edu/visipedia/CUB-200.html
  • Put your dataset (CUB-200-2011 is the default) and put it inside a dataset folder
  • Run dataset.py and it will convert your dataset into following format:
  • Refer to colab.ipynb to see how things run exactly.
dataset
├── train
│   ├── class_001
|   |      ├── 1.jpg
|   |      ├── 2.jpg
|   |      └── ...
│   ├── class_002
|   |      ├── 1.jpg
|   |      ├── 2.jpg
|   |      └── ...
│   └── ...
└── test
    ├── class_001
    |      ├── 1.jpg
    |      ├── 2.jpg
    |      └── ...
    ├── class_002
    |      ├── 1.jpg
    |      ├── 2.jpg
    |      └── ...
    └── ...

  • If your dataset is not CUB_2011, refer to above structure or refer to my custom function.

Config

  • Model parameters are controlled by config.py.
  • The only thing that you should touch is model type: ce_vanilla, ce_label_smooth, complement,
  • The above parameter controls the loss function that you will be using. The vanilla function will just use cross entropy
  • When you are training, make sure the number of classes match your dataset(i.e 200)

Train

  • Just run train.py
  • Batch size will automatically adjust based on your computer capacity. Recommended size is 16.
  • The performance will suffer if you cannot acheive batch size of 16.
  • 16-bit precision is used.

weights

About

Fine grained classification using progressive jigsaw learning. Implementation in Pytorch Lightning

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published