-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d981bda
commit dc0ebc9
Showing
2 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from torch import nn | ||
from torchvision.models import resnet18 | ||
|
||
|
||
class Resnet18(nn.Module): | ||
""" Resnet18 model for CIFAR-100 (modifactions based on FOB benchmark) """ | ||
def __init__(self): | ||
super().__init__() | ||
self.model = resnet18(num_classes=100, pretrained=False) | ||
# 7x7 conv is too large for 32x32 images | ||
self.model.conv1 = nn.Conv2d( | ||
in_channels=3, # rgb color | ||
out_channels=64, | ||
kernel_size=3, | ||
stride=1, | ||
padding=4, | ||
padding_mode="reflect", | ||
) | ||
# pooling small images is bad | ||
self.model.maxpool = nn.Identity() | ||
|
||
def forward(self, x): | ||
return self.model(x) | ||
|
||
|