Commit ·
ea45513
1
Parent(s): 648876d
face expressions
Browse files
app/Hackathon_setup/exp_recognition.py
CHANGED
|
@@ -60,8 +60,14 @@ def get_expression(img):
|
|
| 60 |
# Recreate the same model architecture
|
| 61 |
num_classes = 7 # 👈 change this to match your training setup
|
| 62 |
|
| 63 |
-
model = models.resnet18(weights=None)
|
| 64 |
-
model.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
|
| 66 |
model = model.to(device)
|
| 67 |
|
|
|
|
| 60 |
# Recreate the same model architecture
|
| 61 |
num_classes = 7 # 👈 change this to match your training setup
|
| 62 |
|
| 63 |
+
model = models.resnet18(weights=None)
|
| 64 |
+
model.conv1 = nn.Conv2d(1, 64, kernel_size=7, stride=2, padding=3, bias=False)
|
| 65 |
+
# no pretrained weights now
|
| 66 |
+
model.fc = nn.Sequential(
|
| 67 |
+
nn.Linear(model.fc.in_features, 256),
|
| 68 |
+
nn.ReLU(inplace=True),
|
| 69 |
+
nn.Linear(256, num_classes)
|
| 70 |
+
)
|
| 71 |
|
| 72 |
model = model.to(device)
|
| 73 |
|