Transfer Learning

نقل التعلم

Definition

Reusing the knowledge of a model trained on a large task or dataset to speed up and improve learning on another, related task.

Definition

Transfer learning is a machine learning approach in which knowledge gained while solving a source task is reused to improve learning on a different but related target task.

Practical examples

Code example Python
import torch.nn as nn
from torchvision import models

model = models.resnet18(weights="IMAGENET1K_V1")  # يحمّل أوزاناً مدربة مسبقاً
for p in model.parameters():
    p.requires_grad = False          # تجميد الطبقات
model.fc = nn.Linear(model.fc.in_features, 3)  # رأس جديد لثلاث فئات

trainable = sum(p.numel() for p in model.parameters() if p.requires_grad)
print(trainable)

Expected output

1539

Scientific sources

References and scientific sources

Learn and review

Suggested terms to learn next