Hi Everyone.
I Have trained a convolutional neural network with below structure.
### Defining Network
class Net(nn.Module):
def __init__(self):
super(Net,self).__init__()
self.conv1 = nn.Conv2d(3,64,kernel_size=7, stride=1, padding=2)
self.drop1 = nn.Dropout2d(p=0.1)
self.maxpool1 = nn.MaxPool2d(5,stride=2)
self.relu1 = nn.ReLU()
self.conv2 = nn.Conv2d(64,128,kernel_size=5, stride=1, padding=2)
self.drop2 = nn.Dropout2d(p=0.2)
......
self.fc1 = nn.Linear(3*3*64, 64)
self.drop4 = nn.Dropout(p=0.5)
self.fc2 = nn.Linear(64,2)
self.drop5 = nn.Dropout(p=0.5)
def forward(self,x):
x = self.conv1(x)
x = self.drop1(x)
x = self.maxpool1(x)
x = self.relu1(x)
x = self.conv2(x)
x = self.drop2(x)
.....
x = self.fc1(x)
x = self.drop4(x)
x = self.fc2(x)
x = self.drop5(x)
return x
In this model, also, I used dropout layer to prevent overfitting problem. Actually, when testing the trained model, should I remove the Dropout layer?