Skip to main content

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}
}

Metadata

Release files for resnet-simple 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for resnet-simple 1.0.1
File Interpreter ABI Platform Actions
resnet_simple-1.0.1-py3-none-any.whl Python 3 none any Details for resnet_simple-1.0.1-py3-none-any.whl

Release files / resnet_simple-1.0.1-py3-none-any.whl

Download URL resnet_simple-1.0.1-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
173d009fea6cb0e6f60311b1f206ee2efaaaa00b109cb8c0ccab0acbd09cc972
BLAKE2b-256 checksum
How to use checksums
c25980d4fb3f6547939e612ad6f96484b591d4b55068d2888707117b2ea578b2
Upload date
Uploaded using Trusted Publishing?
What is 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

Security for resnet-simple 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page