Skip to main content

Resnet implementation in pytorch

Project description

torch-resnet

Unified torch implementation of Resnets with or without pre-activation/width.

This implementation propose Resnets both for small and "large" images (Cifar vs ImageNet) and implements all the model used in the papers introducing the ResNets. Additional models can easily be created using the default class ResNet or PreActResNet. It is also possible to create your own block following the same model as those implemented.

Install

$ pip install torch-resnet

Getting started

import torch

import torch_resnet
from torch_resnet.utils import count_layer

model = torch_resnet.PreActResNet50()  # Build a backbone Resnet50 with pre-activation
model.set_head(nn.Linear(model.out_planes, 10))  # Set a final linear head

count_layers(model)  # -> 54 (In the original paper they do not count shortcut/downsampling layers)

out = model(torch.randn(1, 3, 224, 224))

Results

Work in progress

References

Build and Deploy

$ python -m build
$ python -m twine upload dist/*

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

torch-resnet-0.0.1.tar.gz (8.0 kB view hashes)

Uploaded Source

Built Distribution

torch_resnet-0.0.1-py3-none-any.whl (10.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page