-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #157 from thearyadev/151-add-new-model
151 add new model
- Loading branch information
Showing
6 changed files
with
82 additions
and
1 deletion.
There are no files selected for viewing
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
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 @@ | ||
from .frozen_model import transformer, NNModel as FrozenNeuralNetworkModel |
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,40 @@ | ||
0 | ||
1 | ||
10 | ||
11 | ||
12 | ||
13 | ||
14 | ||
15 | ||
16 | ||
17 | ||
18 | ||
19 | ||
2 | ||
20 | ||
21 | ||
22 | ||
23 | ||
24 | ||
25 | ||
26 | ||
27 | ||
28 | ||
29 | ||
3 | ||
30 | ||
31 | ||
32 | ||
33 | ||
34 | ||
35 | ||
36 | ||
37 | ||
38 | ||
39 | ||
4 | ||
40 | ||
6 | ||
7 | ||
8 | ||
9 |
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,12 @@ | ||
Model Name: thearyadev-initial-15-02-2024 | ||
Class Size: 250 | ||
Epoch 1: Validation Loss: 0.0213, Accuracy: 1.00 | ||
Epoch 2: Validation Loss: 0.0083, Accuracy: 1.00 | ||
Epoch 3: Validation Loss: 0.0045, Accuracy: 1.00 | ||
Epoch 4: Validation Loss: 0.0027, Accuracy: 1.00 | ||
Epoch 5: Validation Loss: 0.0019, Accuracy: 1.00 | ||
Epoch 6: Validation Loss: 0.0013, Accuracy: 1.00 | ||
Epoch 7: Validation Loss: 0.0010, Accuracy: 1.00 | ||
Epoch 8: Validation Loss: 0.0007, Accuracy: 1.00 | ||
Epoch 9: Validation Loss: 0.0006, Accuracy: 1.00 | ||
Epoch 10: Validation Loss: 0.0005, Accuracy: 1.00 |
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,28 @@ | ||
"""this module is written with the help of chatgpt""" | ||
import torchvision.transforms as transforms # type: ignore | ||
import torch.nn as nn | ||
import torch.nn.functional as F | ||
|
||
transformer = transforms.Compose([ | ||
transforms.ToTensor(), | ||
transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]) | ||
]) | ||
|
||
class NNModel(nn.Module): | ||
def __init__(self, num_classes: int) -> None: | ||
super(NNModel, self).__init__() | ||
self.conv1 = nn.Conv2d(3, 6, 5) | ||
self.pool = nn.MaxPool2d(2, 2) | ||
self.conv2 = nn.Conv2d(6, 16, 5) | ||
self.fc1 = nn.Linear(16 * 8 * 22, 120) | ||
self.fc2 = nn.Linear(120, 84) | ||
self.fc3 = nn.Linear(84, num_classes) | ||
|
||
def forward(self, x): | ||
x = self.pool(F.relu(self.conv1(x))) | ||
x = self.pool(F.relu(self.conv2(x))) | ||
x = x.view(-1, 16 * 8 * 22) | ||
x = F.relu(self.fc1(x)) | ||
x = F.relu(self.fc2(x)) | ||
x = self.fc3(x) | ||
return x |
Binary file not shown.