torch-tresnet

Packaged TResNet based on Official PyTorch Implementation

入门
GitHub在线演示
Stars:15
License:Apache License 2.0
更新:2024/3/19

README

TResNet: High Performance GPU-Dedicated Architecture

Packaged TResNet based on Official PyTorch Implementation [paper] [github]

Installation

Install with pip:

pip install torch_tresnet

or directly:

pip install git+https://github.com/tczhangzhi/torch-tresnet

Use

Follow the grammatical conventions of torchvision

from torch_tresnet import tresnet_m, tresnet_l, tresnet_xl, tresnet_m_448, tresnet_l_448, tresnet_xl_448

# pretrianed on 224*224
model = tresnet_m(pretrained=True)
model = tresnet_m(pretrained=True, num_classes=10)
model = tresnet_m(pretrained=True, num_classes=10, in_chans=3)

# pretrianed on 448*448
model = tresnet_m_448(pretrained=True)
model = tresnet_m_448(pretrained=True, num_classes=10)
model = tresnet_m_448(pretrained=True, num_classes=10, in_chans=3)

For a demonstration of training and testing, please see the jupyter notebook, which is an unofficial implementation, please do not use this implementation as the final evaluation standard

Main Results

TResNet Models

TResNet models accuracy and GPU throughput on ImageNet, compared to ResNet50. All measurements were done on Nvidia V100 GPU, with mixed precision. All models are trained on input resolution of 224.

ModelsTop Training Speed (img/sec)Top Inference Speed (img/sec)Max Train Batch SizeTop-1 Acc.
ResNet50805283028879.0
EfficientNetB1440274019679.2
TResNet-M730293051280.7
TResNet-L345139031681.4
TResNet-XL250106024082.0

Comparison To Other Networks

Comparison of ResNet50 to top modern networks, with similar top-1 ImageNet accuracy. All measurements were done on Nvidia V100 GPU with mixed precision. For gaining optimal speeds, training and inference were measured on 90% of maximal possible batch size. Except TResNet-M, all the models' ImageNet scores were taken from the public repository, which specialized in providing top implementations for modern networks. Except EfficientNet-B1, which has input resolution of 240, all other models have input resolution of 224.

ModelTop Training Speed (img/sec)Top Inference Speed (img/sec)Top-1 Acc.Flops[G]
ResNet50805283079.04.1
ResNet50-D600267079.34.4
ResNeXt50490194078.54.3
EfficientNetB1440274079.20.6
SEResNeXt50400177079.04.3
MixNet-L400140079.00.5
TResNet-M730293080.75.5

Transfer Learning SotA Results

Comparison of TResNet to state-of-the-art models on transfer learning datasets (only ImageNet-based transfer learning results). Models inference speed is measured on a mixed precision V100 GPU. Since no official implementation of Gpipe was provided, its inference speed is unknown.

DatasetModelTop-1 Acc.Speed img/secInput
CIFAR-10Gpipe99.0-480
CIFAR-10TResNet-XL99.01060224
CIFAR-100EfficientNet-B791.770600
CIFAR-100TResNet-XL91.51060224
Stanford CarsEfficientNet-B794.770600
Stanford CarsTResNet-L96.0500368
Oxford-FlowersEfficientNet-B798.870600
Oxford-FlowersTResNet-L99.1500368