Created
March 16, 2019 22:41
-
-
Save fg91/3bc3ea7dfa8296fc90aae1cf90e9bda9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
model = models.resnet34(pretrained=True).cuda() | |
# Freeze the base of the network and only train the new custom layers | |
for param in model.parameters(): | |
param.requires_grad = False | |
p=0.1 | |
model.fc = nn.Sequential(nn.BatchNorm1d(512), | |
nn.Dropout(p), | |
nn.Linear(in_features=512, out_features=512, bias=True), | |
nn.ReLU(), | |
nn.BatchNorm1d(512), | |
nn.Dropout(p), | |
nn.Linear(in_features=512, out_features=300, bias=True)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment