February 2018
Intermediate to advanced
262 pages
6h 59m
English
A simple model may end in overfitting, so let's include dropout in the model. Dropout will help avoid overfitting. In the following code, we are creating our model:
class FullyConnectedModel(nn.Module): def __init__(self,in_size,out_size,training=True): super().__init__() self.fc = nn.Linear(in_size,out_size) def forward(self,inp): out = F.dropout(inp, training=self.training) out = self.fc(out) return out# The size of the output from the selected convolution feature fc_in_size = 131072fc = FullyConnectedModel(fc_in_size,classes)if is_cuda: fc = fc.cuda()
Once the model is created, we can train the model.
Read now
Unlock full access