File size: 835 Bytes
b45069f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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

---
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()