Create Models/vision_expert.py
Browse files- Models/vision_expert.py +17 -0
Models/vision_expert.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
import torch.nn as nn
|
| 3 |
+
import torch.nn.functional as F
|
| 4 |
+
|
| 5 |
+
class VisionExpert(nn.Module):
|
| 6 |
+
def __init__(self):
|
| 7 |
+
super(VisionExpert, self).__init__()
|
| 8 |
+
self.conv1 = nn.Conv2d(3, 32, 3, 1)
|
| 9 |
+
self.conv2 = nn.Conv2d(32, 64, 3, 1)
|
| 10 |
+
self.fc1 = nn.Linear(64 * 6 * 6, 128)
|
| 11 |
+
|
| 12 |
+
def forward(self, x):
|
| 13 |
+
x = F.relu(self.conv1(x))
|
| 14 |
+
x = F.relu(self.conv2(x))
|
| 15 |
+
x = x.view(-1, 64 * 6 * 6)
|
| 16 |
+
x = F.relu(self.fc1(x))
|
| 17 |
+
return x
|