menasi11's picture
Upload /content/README.md with huggingface_hub
b45069f verified
---
license: apache-2.0
tags:
- vision
- image-classification
- resnet
- transfer-learning
framework: pytorch
---
# ResNet-18 Transfer Learned Model
This model is a ResNet-18 fine-tuned using transfer learning.
The backbone is frozen and a custom classifier head is trained.
## Classifier
Linear(512 β†’ 120) β†’ ReLU β†’ Dropout(0.2) β†’ Linear(120 β†’ 10)
## Usage
```python
import torch
import torch.nn as nn
from torchvision import models
from huggingface_hub import hf_hub_download
model = models.resnet18(weights=None)
model.fc = nn.Sequential(
nn.Linear(512, 120),
nn.ReLU(),
nn.Dropout(0.2),
nn.Linear(120, 10)
)
path = hf_hub_download(
repo_id="<your-username>/resnet18-transfer-learned",
filename="pytorch_model.bin"
)
model.load_state_dict(torch.load(path, map_location="cpu"))
model.eval()