File size: 1,428 Bytes
3386886 e3ae3d1 3386886 e3ae3d1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
---
license: mit
pipeline_tag: image-classification
---
# ResNet-20 model for CIFAR-10
This is the repo for a custom-made neural network based on ResNet architecture that has been trained on CIFAR-10 dataset.
## Model details
- **Architecture:** ResNet
- **Input shape:** 3x32x32
- **Output classes:** 10
- **Parameters:** 272,474
- **Dataset:** CIFAR-10
More details can be found in the `config.json` file inside this repository and the original [git repository](https://github.com/spolivin/cifar10-website/blob/master/nn_dev/pytorch_models/architectures.py) from which the model originated.
## Model usage
Since the model for which the weights loaded in this repository are intended is a part of a custom Python package, one needs to firstly clone the project locally:
```bash
git clone https://github.com/spolivin/cifar10-website.git
cd cifar10-website/nn_dev
```
Next, in a Python script we can make imports and load the weights:
```python
import torch
from pytorch_models import resnet20
# URL from which to load the weights
URL = "https://huggingface.co/spolivin/cnn-cifar10/resolve/main/resnet20_weights.pth"
# Building the ResNet-20 model
resnet20_model = resnet20()
# Loading the pretrained weights to the model
resnet20_model.load_state_dict(
torch.hub.load_state_dict_from_url(
url=URL,
weights_only=True,
map_location=torch.device("cpu"),
)
)
```
|