Spaces:
Running
Running
| import torch.nn as nn | |
| class RelationshipNet(nn.Module): | |
| def __init__(self, num_classes): | |
| super().__init__() | |
| self.model = nn.Sequential( | |
| nn.Conv2d(3, 32, 3, padding=1), | |
| nn.ReLU(), | |
| nn.MaxPool2d(2), | |
| nn.Conv2d(32, 64, 3, padding=1), | |
| nn.ReLU(), | |
| nn.MaxPool2d(2), | |
| nn.Conv2d(64, 128, 3, padding=1), | |
| nn.ReLU(), | |
| nn.MaxPool2d(2), | |
| nn.Flatten(), | |
| nn.Linear(128 * 16 * 16, 256), | |
| nn.ReLU(), | |
| nn.Linear(256, num_classes) | |
| ) | |
| def forward(self, x): | |
| return self.model(x) |