menasi11's picture
Upload /content/README.md with huggingface_hub
b45069f verified
metadata
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

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