Skip to main content

Python package that provides a well-documented and easy to use implementation of ResNet (and ResNetv1.5), together with its most basic use case of image classification.

Project description

resnet-simple

Python Version GitHub license PyPI downloads Open All Collab

resnet-simple is a Python3 library that provides a well-documented and easy to use implementation of ResNet (and ResNetv1.5), together with its most basic use case of image classification.

ResNet

Residual Network, more commonly known as ResNet, is a deep learning model that is most commonly used for image recogition and classification. It was first introduced by He et al. in the paper titled "Deep Residual Learning for Image Recognition". Each ResNet has multiple residual blocks that takes an input $x$ and pass it through stacked non-linear layers which are fit to the residual mapping $F(x) := H(x) - x$, where $H(x)$ is the original unreferenced mapping which can be recast back via $H(x) = F(x) + x$. Intuitively speaking, ResNets should achieve higher accuracy than models that purely use convolutional networks (CNNs) such as VGGNet and AlexNet, as technically it should be easier to optimize and learn residual mapping than an unreferenced one.

This module allows you to choose between the original ResNet (v1) and the modified ResNet (v1.5), in which the latter enjoys a slight increase in accuracy at the expense of a slower performance. To do so, set downsample_3x3 = True under the BottleNeck/ResNet class to use ResNetv1.5, and downsample_3x3 = False for ResNetv1. This feature only works for ResNets that use BottleNeck blocks such as ResNet50, ResNet101 and ResNet152.

How to use resnet-simple

resnet-simple only supports python 3.7 and above. If you want to use resnet-simple for other versions of Python, do note that it may not function as intended.

Module is mainly tested on Google Colab (GPU) and Windows (CPU). Issues when setting up in other environments, or when using multiple GPU cores, are still relatively unknown.

Dependencies

The following libraries are compulsory in order to use resnet-simple, which is automatically installed together with it unless otherwise specified:

  • tqdm
  • torch
  • safetensors

When pip installing resnet-simple, the following libraries will also be installed as they are used in our examples:

  • matplotlib
  • torchvision
  • tensorboard
  • scikit-learn (for Python 3.7, use version 1.0.2)

User installation

In command prompt on Windows,

pip install resnet-simple

In your python file,

from resnet_simple import *

Contributions

I appreciate if you are able to contribute to this project as I am the only contributor for now. If you think that something is wrong with my code, you can open an issue and I'll try my best to resolve it!

Citation

The code from this module is re-implemented based on what was described in the following paper.

@inproceedings{inproceedings,
author = {He, Kaiming and Zhang, Xiangyu and Ren, Shaoqing and Sun, Jian},
year = {2016},
month = {06},
pages = {770-778},
title = {Deep Residual Learning for Image Recognition},
doi = {10.1109/CVPR.2016.90}
}@misc{he2015deep,
      title={Deep Residual Learning for Image Recognition}, 
      author={Kaiming He and Xiangyu Zhang and Shaoqing Ren and Jian Sun},
      year={2015},
      eprint={1512.03385},
      archivePrefix={arXiv},
      primaryClass={cs.CV}
}

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

resnet_simple-1.0.1-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file resnet_simple-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: resnet_simple-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.64.1 importlib-metadata/4.8.2 keyring/23.5.0 rfc3986/1.4.0 colorama/0.4.6 CPython/3.7.6

File hashes

Hashes for resnet_simple-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 173d009fea6cb0e6f60311b1f206ee2efaaaa00b109cb8c0ccab0acbd09cc972
MD5 8f913a52b8de3fee6634e3af708c2433
BLAKE2b-256 c25980d4fb3f6547939e612ad6f96484b591d4b55068d2888707117b2ea578b2

See more details on using hashes here.

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