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
The code of “Similarity Reasoning and Filtration for Image-Text Matching” [AAAI2021]

SGRAF PyTorch implementation for AAAI2021 paper of “Similarity Reasoning and Filtration for Image-Text Matching”. It is built on top of the SCAN and C

Ronnie_IIAU 149 Dec 22, 2022
The codes of paper 'Active-LATHE: An Active Learning Algorithm for Boosting the Error exponent for Learning Homogeneous Ising Trees'

Active-LATHE: An Active Learning Algorithm for Boosting the Error exponent for Learning Homogeneous Ising Trees This project contains the codes of pap

0 Apr 20, 2022
Official implementation of Monocular Quasi-Dense 3D Object Tracking

Monocular Quasi-Dense 3D Object Tracking Monocular Quasi-Dense 3D Object Tracking (QD-3DT) is an online framework detects and tracks objects in 3D usi

Visual Intelligence and Systems Group 441 Dec 20, 2022
Really awesome semantic segmentation

really-awesome-semantic-segmentation A list of all papers on Semantic Segmentation and the datasets they use. This site is maintained by Holger Caesar

Holger Caesar 400 Nov 28, 2022
Evaluating saliency methods on artificial data with different background types

Evaluating saliency methods on artificial data with different background types This repository contains the relevant code for the MedNeurips 2021 subm

2 Jul 05, 2022
Quick program made to generate alpha and delta tables for Hidden Markov Models

HMM_Calc Functions for generating Alpha and Delta tables from a Hidden Markov Model. Parameters: a: Matrix of transition probabilities. a[i][j] = a_{i

Adem Odza 1 Dec 04, 2021
Nicholas Lee 3 Jan 09, 2022
The repo contains the code to train and evaluate a system which extracts relations and explanations from dialogue.

The repo contains the code to train and evaluate a system which extracts relations and explanations from dialogue. How do I cite D-REX? For now, cite

Alon Albalak 6 Mar 31, 2022
A resource for learning about ML, DL, PyTorch and TensorFlow. Feedback always appreciated :)

A resource for learning about ML, DL, PyTorch and TensorFlow. Feedback always appreciated :)

Aladdin Persson 4.7k Jan 08, 2023
A deep neural networks for images using CNN algorithm.

Example-CNN-Project This is a simple project showing how to implement deep neural networks using CNN algorithm. The dataset is taken from this link: h

Mohammad Amin Dadgar 3 Sep 16, 2022
A python module for configuration of block devices

Blivet is a python module for system storage configuration. CI status Licence See COPYING Installation From Fedora repositories Blivet is available in

78 Dec 14, 2022
This is a project based on ConvNets used to identify whether a road is clean or dirty. We have used MobileNet as our base architecture and the weights are based on imagenet.

PROJECT TITLE: CLEAN/DIRTY ROAD DETECTION USING TRANSFER LEARNING Description: This is a project based on ConvNets used to identify whether a road is

Faizal Karim 3 Nov 06, 2022
Official page of Struct-MDC (RA-L'22 with IROS'22 option); Depth completion from Visual-SLAM using point & line features

Struct-MDC (click the above buttons for redirection!) Official page of "Struct-MDC: Mesh-Refined Unsupervised Depth Completion Leveraging Structural R

Urban Robotics Lab. @ KAIST 37 Dec 22, 2022
DISTIL: Deep dIverSified inTeractIve Learning.

DISTIL: Deep dIverSified inTeractIve Learning. An active/inter-active learning library built on py-torch for reducing labeling costs.

decile-team 110 Dec 06, 2022
Official code for 'Weakly-supervised Video Anomaly Detection with Robust Temporal Feature Magnitude Learning' [ICCV 2021]

RTFM This repo contains the Pytorch implementation of our paper: Weakly-supervised Video Anomaly Detection with Robust Temporal Feature Magnitude Lear

Yu Tian 242 Jan 08, 2023
Official repository of the paper "GPR1200: A Benchmark for General-PurposeContent-Based Image Retrieval"

GPR1200 Dataset GPR1200: A Benchmark for General-Purpose Content-Based Image Retrieval (ArXiv) Konstantin Schall, Kai Uwe Barthel, Nico Hezel, Klaus J

Visual Computing Group 16 Nov 21, 2022
This repository contains the code for the paper "PIFu: Pixel-Aligned Implicit Function for High-Resolution Clothed Human Digitization"

PIFu: Pixel-Aligned Implicit Function for High-Resolution Clothed Human Digitization News: [2020/05/04] Added EGL rendering option for training data g

Shunsuke Saito 1.5k Jan 03, 2023
这是一个mobilenet-yolov4-lite的库,把yolov4主干网络修改成了mobilenet,修改了Panet的卷积组成,使参数量大幅度缩小。

YOLOV4:You Only Look Once目标检测模型-修改mobilenet系列主干网络-在Keras当中的实现 2021年2月8日更新: 加入letterbox_image的选项,关闭letterbox_image后网络的map一般可以得到提升。

Bubbliiiing 65 Dec 01, 2022
Adversarial Framework for (non-) Parametric Image Stylisation Mosaics

Fully Adversarial Mosaics (FAMOS) Pytorch implementation of the paper "Copy the Old or Paint Anew? An Adversarial Framework for (non-) Parametric Imag

Zalando Research 120 Dec 24, 2022
A texturizer that I just made. Nothing special here.

texturizer This is a little project that I did with an hour's time. It texturizes an image given a image and a texture to texturize it with. There is

1 Nov 11, 2021