-
-
Save Sivaram46/c1d7eeb4cb1c178fe2b57678a0507d7b to your computer and use it in GitHub Desktop.
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
# a block consists of initial conv layers followed by 6 dense layers | |
dense_block = nn.Sequential( | |
nn.Conv2d(3, 64, kernel_size=7, padding=3, stride=2, bias=False), | |
nn.BatchNorm2d(64), | |
nn.MaxPool2d(3, 2), | |
Dense_Block(6, 64, growthrate=32, bn_size=4), | |
) | |
inputs = torch.rand(1, 3, 100, 100) | |
outputs = dense_block(inputs) | |
print(outputs.shape) # shape would be (1, 256, 24, 24) | |
# one could also use pretrained weights of DenseNet trained on ImageNet | |
densenet121 = torchvision.models.densenet121(pretrained=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment