Quickly comparing your image classification models with the state-of-the-art models (such as DenseNet, ResNet, ...)

Overview

Image Classification Project Killer in PyTorch

This repo is designed for those who want to start their experiments two days before the deadline and kill the project in the last 6 hours. 🌚 Inspired by fb.torch.resnet, it provides fast experiment setup and attempts to maximize the number of projects killed within the given time. Please feel free to submit issues or pull requests if you want to contribute.

News

Usage

Both Python 2.7 and 3 are supported; however, it was mainly tested on Python 3. Use python main.py -h to show all arguments.

Training

Train a ResNet-56 on CIFAR-10 with data augmentation using GPU0:

CUDA_VISIBLE_DEVICES=0 python main.py --data cifar10 --data_aug --arch resnet --depth 56 --save save/cifar10 -resnet-56 --epochs 164

Train a ResNet-110 on CIFAR-100 without data augmentation using GPU0 and GPU2:

CUDA_VISIBLE_DEVICES=0,2 python main.py --data cifar100 --arch resnet --depth 110 --save save/cifar100-resnet-110 --epochs 164

See scripts/cifar10.sh and scripts/cifar100.sh for more training examples.

Evaluation

python main.py --resume save/resnet-56/model_best.pth.tar --evaluate test --data cifar10

Adding your custom model

You can write your own model in a .py file and put it into models folder. All you need it to provide a createModel(arg1, arg2, **kwarg) function that returns the model which is an instance of nn.Module. Then you'll be able to use your model by setting --arch your_model_name (assuming that your model is in a the file models/your_model_name).

Show Training & Validation Results

Python script

getbest.py save/* FOLDER_1 FOLDER_2

In short, this script reads the scores.tsv in the saving folders and display the best validation errors of them.

Using Tensorboard

tensorboard --logdir save --port PORT

Features

Experiment Setup & Logging

  • Ask before overwriting existing experiments, and move the old one to /tmp instead of overwriting
  • Saving training/validation loss, errors, and learning rate of each epoch to a TSV file
  • Automatically copying all source code to saving directory to prevent accidental deleteion of codes. This is inspired by SGAN code.
  • TensorBoard support using tensorboard_logger
  • One script to show all experiment results
  • Display training time
  • Holding out testing set and using validation set for hyperparameter tuning experiments
  • GPU support
  • Adding save & data folders to .gitignore to prevent commiting the datasets and trained models
  • Result table
  • Python 2.7 & 3.5 support

Models (See models folder for details)

Datasets

CIFAR

Last 5000 samples in the original training set is used for validation. Each pixel is in [0, 1]. Based on experiments results, normalizing the data to zero mean and unit standard deviation seems to be redundant.

  • CIFAR-10
  • CIFAR-100

Results

Test Error Rate (in percentage) with validation set

The number of parameters are calculated based on CIFAR-10 model. ResNets were training with 164 epochs (the same as the default setting in fb.resnet.torch) and DenseNets were trained 300 epochs. Both are using batch_size=64.

Model Parameters CIFAR-10 CIFAR-10 (aug) CIFAR-100 CIFAR-100 (aug)
ResNet-56 0.86M 6.82
ResNet-110 1.73M
ResNet-110 with Stochastic Depth 1.73M 5.25 24.2
DenseNet-BC-100 (k=12) 0.8M 5.34
DenseNet-BC-190 (k=40) 25.6M
Your model

Top1 Testing Error Rate (in percentage)

Coming soon...

File Descriptions

  • main.py: main script to train or evaluate models
  • train.py: training and evaluation part of the code
  • config: storing configuration of datasets (and maybe other things in the future)
  • utils.pypy: useful functions
  • getbest.py: display the best validation error of each saving folder
  • dataloader.py: defines getDataloaders function which is used to load datasets
  • models: a folder storing all network models. Each script in it should contain a createModel(**kwargs) function that takes the arguments and return a model (subclass of nn.Module) for training
  • scripts: a folder storing example training commands in UNIX shell scripts

Acknowledgement

This code is based on the ImageNet training script provided in PyTorch examples.

The author is not familiar with licensing. Please contact me there is there are any problems with it.

Owner
Felix Wu
Survival analysis (SA) is a well-known statistical technique for the study of temporal events.

DAGSurv Survival analysis (SA) is a well-known statistical technique for the study of temporal events. In SA, time-to-an-event data is modeled using a

Rahul Kukreja 1 Sep 05, 2022
code for paper -- "Seamless Satellite-image Synthesis"

Seamless Satellite-image Synthesis by Jialin Zhu and Tom Kelly. Project site. The code of our models borrows heavily from the BicycleGAN repository an

Light 14 Apr 05, 2022
Python and Julia in harmony.

PythonCall & JuliaCall Bringing Python® and Julia together in seamless harmony: Call Python code from Julia and Julia code from Python via a symmetric

Christopher Rowley 414 Jan 07, 2023
Information-Theoretic Multi-Objective Bayesian Optimization with Continuous Approximations

Information-Theoretic Multi-Objective Bayesian Optimization with Continuous Approximations Requirements The code is implemented in Python and requires

1 Nov 03, 2021
Monify: an Expense tracker Program implemented in a Graphical User Interface that allows users to keep track of their expenses

💳 MONIFY (EXPENSE TRACKER PRO) 💳 Description Monify is an Expense tracker Program implemented in a Graphical User Interface allows users to add inco

Moyosore Weke 1 Dec 14, 2021
Efficient and Accurate Arbitrary-Shaped Text Detection with Pixel Aggregation Network

Efficient and Accurate Arbitrary-Shaped Text Detection with Pixel Aggregation Network Paddle-PANet 目录 结果对比 论文介绍 快速安装 结果对比 CTW1500 Method Backbone Fine

7 Aug 08, 2022
Code for the TASLP paper "PSLA: Improving Audio Tagging With Pretraining, Sampling, Labeling, and Aggregation".

PSLA: Improving Audio Tagging with Pretraining, Sampling, Labeling, and Aggregation Introduction Getting Started FSD50K Recipe AudioSet Recipe Label E

Yuan Gong 84 Dec 27, 2022
Wenet STT Python

Wenet STT Python Beta Software Simple Python library, distributed via binary wheels with few direct dependencies, for easily using WeNet models for sp

David Zurow 33 Feb 21, 2022
Code to reproduce the results in the paper "Tensor Component Analysis for Interpreting the Latent Space of GANs".

Tensor Component Analysis for Interpreting the Latent Space of GANs [ paper | project page ] Code to reproduce the results in the paper "Tensor Compon

James Oldfield 4 Jun 17, 2022
Hardware-accelerated DNN model inference ROS2 packages using NVIDIA Triton/TensorRT for both Jetson and x86_64 with CUDA-capable GPU

Isaac ROS DNN Inference Overview This repository provides two NVIDIA GPU-accelerated ROS2 nodes that perform deep learning inference using custom mode

NVIDIA Isaac ROS 62 Dec 14, 2022
Balancing Principle for Unsupervised Domain Adaptation

Blancing Principle for Domain Adaptation NeurIPS 2021 Paper Abstract We address the unsolved algorithm design problem of choosing a justified regulari

Marius-Constantin Dinu 4 Dec 15, 2022
这个开源项目主要是对经典的时间序列预测算法论文进行复现,模型主要参考自GluonTS,框架主要参考自Informer

Time Series Research with Torch 这个开源项目主要是对经典的时间序列预测算法论文进行复现,模型主要参考自GluonTS,框架主要参考自Informer。 建立原因 相较于mxnet和TF,Torch框架中的神经网络层需要提前指定输入维度: # 建立线性层 TensorF

Chi Zhang 85 Dec 29, 2022
Pytorch implementation of forward and inverse Haar Wavelets 2D

Pytorch implementation of forward and inverse Haar Wavelets 2D

Sergei Belousov 9 Oct 30, 2022
InsightFace: 2D and 3D Face Analysis Project on MXNet and PyTorch

InsightFace: 2D and 3D Face Analysis Project on MXNet and PyTorch

Deep Insight 13.2k Jan 06, 2023
Official PyTorch implementation of "Contrastive Learning from Extremely Augmented Skeleton Sequences for Self-supervised Action Recognition" in AAAI2022.

AimCLR This is an official PyTorch implementation of "Contrastive Learning from Extremely Augmented Skeleton Sequences for Self-supervised Action Reco

Gty 44 Dec 17, 2022
Official Pytorch implementation of the paper: "Locally Shifted Attention With Early Global Integration"

Locally-Shifted-Attention-With-Early-Global-Integration Pretrained models You can download all the models from here. Training Imagenet python -m torch

Shelly Sheynin 14 Apr 15, 2022
Generalized Data Weighting via Class-level Gradient Manipulation

Generalized Data Weighting via Class-level Gradient Manipulation This repository is the official implementation of Generalized Data Weighting via Clas

18 Nov 12, 2022
The implementation of PEMP in paper "Prior-Enhanced Few-Shot Segmentation with Meta-Prototypes"

Prior-Enhanced network with Meta-Prototypes (PEMP) This is the PyTorch implementation of PEMP. Overview of PEMP Meta-Prototypes & Adaptive Prototypes

Jianwei ZHANG 8 Oct 14, 2021
HiPAL: A Deep Framework for Physician Burnout Prediction Using Activity Logs in Electronic Health Records

HiPAL Code for KDD'22 Applied Data Science Track submission -- HiPAL: A Deep Framework for Physician Burnout Prediction Using Activity Logs in Electro

Hanyang Liu 4 Aug 08, 2022
pytorch implementation for PointNet

PointNet.pytorch This repo is implementation for PointNet in pytorch. The model is in pointnet/model.py. It is teste

Fei Xia 1.7k Dec 30, 2022