menasi11 commited on
Commit
b45069f
·
verified ·
1 Parent(s): 2104dbe

Upload /content/README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. content/README.md +42 -0
content/README.md ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ ---
3
+ license: apache-2.0
4
+ tags:
5
+ - vision
6
+ - image-classification
7
+ - resnet
8
+ - transfer-learning
9
+ framework: pytorch
10
+ ---
11
+
12
+ # ResNet-18 Transfer Learned Model
13
+
14
+ This model is a ResNet-18 fine-tuned using transfer learning.
15
+ The backbone is frozen and a custom classifier head is trained.
16
+
17
+ ## Classifier
18
+ Linear(512 → 120) → ReLU → Dropout(0.2) → Linear(120 → 10)
19
+
20
+ ## Usage
21
+
22
+ ```python
23
+ import torch
24
+ import torch.nn as nn
25
+ from torchvision import models
26
+ from huggingface_hub import hf_hub_download
27
+
28
+ model = models.resnet18(weights=None)
29
+ model.fc = nn.Sequential(
30
+ nn.Linear(512, 120),
31
+ nn.ReLU(),
32
+ nn.Dropout(0.2),
33
+ nn.Linear(120, 10)
34
+ )
35
+
36
+ path = hf_hub_download(
37
+ repo_id="<your-username>/resnet18-transfer-learned",
38
+ filename="pytorch_model.bin"
39
+ )
40
+
41
+ model.load_state_dict(torch.load(path, map_location="cpu"))
42
+ model.eval()