idstcv / GPU-Efficient-Networks

TOP 1 ACCURACY TOP 5 ACCURACY
SPEED
MODEL CODE PAPER
ε-REPR
CODE PAPER
ε-REPR
PAPER
GLOBAL RANK
GENet-large
81.4% 81.3% 95.5% -- 677.1 #103
GENet-light
75.7% 75.7% 92.3% -- 707.7 #360
GENet-normal
79.9% 80.0% 94.7% -- 713.6 #179
See Full Build Details +get badge code
[![SotaBench](https://img.shields.io/endpoint.svg?url=https://sotabench.com/api/v0/badge/gh/Randl/GPU-Efficient-Networks)](https://sotabench.com/user/EvgeniiZh/repos/Randl/GPU-Efficient-Networks)

How the Repository is Evaluated

The full sotabench.py file - source
import gc
import math

import torch
from torchbench.datasets.utils import download_file_from_google_drive
from torchbench.image_classification import ImageNet
from torchvision.transforms import transforms

import GENet

# GENet-large
file_id = '1xuyW2GB_kUfJNf2G146rk1sdKuYGxWlE'
destination = './GENet_params/'
filename = 'GENet_large.pth'
download_file_from_google_drive(file_id, destination, filename=filename)

input_image_size = 256
model = GENet.genet_large(pretrained=True, root='./GENet_params/')

input_image_crop = 0.875
resize_image_size = int(math.ceil(input_image_size / input_image_crop))
transforms_normalize = transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
transform_list = [transforms.Resize(resize_image_size),
                  transforms.CenterCrop(input_image_size), transforms.ToTensor(), transforms_normalize]
transformer = transforms.Compose(transform_list)
# load model
model = model.cuda().half()
model.eval()


def send_data(input, target, device, dtype=torch.float16, non_blocking: bool = True):
    input = input.to(device=device, dtype=dtype, non_blocking=non_blocking)

    if target is not None:
        target = target.to(device=device, dtype=dtype, non_blocking=non_blocking)

    return input, target


print('Benchmarking GENet-large')
# Run the benchmark
ImageNet.benchmark(
    model=model,
    paper_model_name='GENet-large',
    paper_arxiv_id='2006.14090',
    input_transform=transformer,
    send_data_to_device=send_data,
    batch_size=128,
    num_workers=8,
    num_gpu=1,
    pin_memory=True,
    paper_results={'Top 1 Accuracy': 0.813},
    model_description="GENet-large"
)

del model
gc.collect()
torch.cuda.empty_cache()

# GENet-normal
file_id = '1rpL0BKI_l5Xg4vN5fHGXPzTna5kW9hfs'
destination = './GENet_params/'
filename = 'GENet_normal.pth'
download_file_from_google_drive(file_id, destination, filename=filename)
input_image_size = 192
model = GENet.genet_normal(pretrained=True, root='./GENet_params/')

input_image_crop = 0.875
resize_image_size = int(math.ceil(input_image_size / input_image_crop))
transforms_normalize = transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
transform_list = [transforms.Resize(resize_image_size),
                  transforms.CenterCrop(input_image_size), transforms.ToTensor(), transforms_normalize]
transformer = transforms.Compose(transform_list)
# load model
model = model.cuda().half()
model.eval()

print('Benchmarking GENet-normal')
# Run the benchmark
ImageNet.benchmark(
    model=model,
    paper_model_name='GENet-normal',
    paper_arxiv_id='2006.14090',
    input_transform=transformer,
    send_data_to_device=send_data,
    batch_size=128,
    num_workers=8,
    num_gpu=1,
    pin_memory=True,
    paper_results={'Top 1 Accuracy': 0.800},
    model_description="GENet-normal"
)

del model
gc.collect()
torch.cuda.empty_cache()

# GENet-light
file_id = '1jAkklQlQFPZi4odKUvbKEsNPYSS76GAv'
destination = './GENet_params/'
filename = 'GENet_small.pth'
download_file_from_google_drive(file_id, destination, filename=filename)
input_image_size = 192
model = GENet.genet_small(pretrained=True, root='./GENet_params/')

input_image_crop = 0.875
resize_image_size = int(math.ceil(input_image_size / input_image_crop))
transforms_normalize = transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
transform_list = [transforms.Resize(resize_image_size),
                  transforms.CenterCrop(input_image_size), transforms.ToTensor(), transforms_normalize]
transformer = transforms.Compose(transform_list)
# load model
model = model.cuda().half()
model.eval()

print('Benchmarking GENet-light')
# Run the benchmark
ImageNet.benchmark(
    model=model,
    paper_model_name='GENet-light',
    paper_arxiv_id='2006.14090',
    input_transform=transformer,
    send_data_to_device=send_data,
    batch_size=128,
    num_workers=8,
    num_gpu=1,
    pin_memory=True,
    paper_results={'Top 1 Accuracy': 0.757},
    model_description="GENet-light"
)

del model
gc.collect()
torch.cuda.empty_cache()
STATUS
BUILD
COMMIT MESSAGE
RUN TIME
Add LICENSE note for sotabench_setup.sh
Randl   47a2293  ·  Sep 25 2020
0h:32m:35s
Transform to fp16
Randl   a687a4b  ·  Sep 18 2020
0h:30m:42s
Fix filename
Randl   3314486  ·  Sep 18 2020
0h:25m:58s
Fix paper id
Randl   20f7e74  ·  Sep 18 2020
0h:14m:44s
Fix import
Randl   7ea5b68  ·  Sep 18 2020
0h:04m:33s
0h:16m:25s