hadrilec commited on
Commit
96750df
·
1 Parent(s): a59f65d

readme update

Browse files
Files changed (2) hide show
  1. README.md +38 -10
  2. install.sh +1 -0
README.md CHANGED
@@ -71,19 +71,47 @@ This repository contains a **custom convolutional neural network** trained on sa
71
  class Net(nn.Module):
72
  def __init__(self):
73
  super().__init__()
74
- self.conv1 = nn.Conv2d(3, 16, kernel_size=3, padding=1)
75
- self.conv2 = nn.Conv2d(16, 8, kernel_size=3, padding=1)
76
- self.fc1 = nn.Linear(8 * 64 * 64, 32)
77
- self.fc2 = nn.Linear(32, 4)
 
 
 
 
 
 
 
 
 
 
 
 
 
78
 
79
  def forward(self, x):
80
- out = F.max_pool2d(torch.tanh(self.conv1(x)), 2)
81
- out = F.max_pool2d(torch.tanh(self.conv2(out)), 2)
82
- out = out.view(-1, 8 * 64 * 64)
83
- out = torch.tanh(self.fc1(out))
84
- out = self.fc2(out)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  return out
86
 
 
87
  ```
88
  ## Example Notebook
89
 
@@ -93,7 +121,7 @@ We provide an example notebook that demonstrates how to train the model:
93
 
94
  This notebook is intended as a starting point for experimentation and helps you quickly see how to use the dataset in practice.
95
 
96
- Accuracy is 0.9728
97
 
98
  ## IT infrastructure
99
 
 
71
  class Net(nn.Module):
72
  def __init__(self):
73
  super().__init__()
74
+
75
+ # Feature extractor
76
+ self.conv1 = nn.Conv2d(4, 16, kernel_size=3, padding=1) # (RGB + EDGE: 3 + 1)
77
+ self.bn1 = nn.BatchNorm2d(16)
78
+
79
+ self.conv2 = nn.Conv2d(16, 32, kernel_size=3, padding=1)
80
+ self.bn2 = nn.BatchNorm2d(32)
81
+
82
+ self.conv3 = nn.Conv2d(32, 64, kernel_size=3, padding=1)
83
+ self.bn3 = nn.BatchNorm2d(64)
84
+
85
+ # After 3x maxpool (stride=2), 256 -> 128 -> 64 -> 32
86
+ self.fc1 = nn.Linear(64 * 32 * 32, 256)
87
+ self.fc2 = nn.Linear(256, 64)
88
+ self.fc3 = nn.Linear(64, 4) # 4 classes
89
+
90
+ self.dropout = nn.Dropout(0.5)
91
 
92
  def forward(self, x):
93
+ # Conv layers
94
+ out = F.relu(self.bn1(self.conv1(x)))
95
+ out = F.max_pool2d(out, 2) # 256 -> 128
96
+
97
+ out = F.relu(self.bn2(self.conv2(out)))
98
+ out = F.max_pool2d(out, 2) # 128 -> 64
99
+
100
+ out = F.relu(self.bn3(self.conv3(out)))
101
+ out = F.max_pool2d(out, 2) # 64 -> 32
102
+
103
+ # Flatten
104
+ out = out.view(out.size(0), -1)
105
+
106
+ # Fully connected layers
107
+ out = F.relu(self.fc1(out))
108
+ out = self.dropout(out)
109
+
110
+ out = F.relu(self.fc2(out))
111
+ out = self.fc3(out) # logits, apply CrossEntropyLoss
112
  return out
113
 
114
+
115
  ```
116
  ## Example Notebook
117
 
 
121
 
122
  This notebook is intended as a starting point for experimentation and helps you quickly see how to use the dataset in practice.
123
 
124
+ Accuracy is 0.9745
125
 
126
  ## IT infrastructure
127
 
install.sh CHANGED
@@ -2,3 +2,4 @@
2
  # Install Git LFS
3
  sudo apt-get update && sudo apt-get install -y git-lfs
4
  git lfs install
 
 
2
  # Install Git LFS
3
  sudo apt-get update && sudo apt-get install -y git-lfs
4
  git lfs install
5
+ sudo apt-get install -y libgl1