Initial commit

This commit is contained in:
2026-05-01 15:28:10 +02:00
commit 9285ede90a
14 changed files with 566 additions and 0 deletions

22
architectures/ResNet18.py Normal file
View File

@@ -0,0 +1,22 @@
import torch.nn as nn
from torchvision import models
# Base model
from architectures.Model import Model
class ResNet18(Model):
def get(self):
m = models.resnet18(weights=models.ResNet18_Weights.DEFAULT)
# freez all layers
for param in m.parameters():
param.requires_grad = False
# unfreez the last two
for param in m.layer3.parameters(): param.requires_grad = True
for param in m.layer4.parameters(): param.requires_grad = True
m.fc = nn.Linear(m.fc.in_features, self.size)
return m.to(self.device)