Views
No views yet
1DenseNet.densenet121()
2DenseNet.densenet161()
3DenseNet.densenet169()
4DenseNet.densenet201()1# change activation
2DenseNet.densenet121(activation = nn.SELU)
3# change number of classes (default is 1000 )
4DenseNet.densenet121(n_classes=100)
5# pass a different block
6DenseNet.densenet121(block=...)
7# change the initial convolution
8model = DenseNet.densenet121()
9model.encoder.gate.conv1 = nn.Conv2d(3, 64, kernel_size=3)
10# store each feature
11x = torch.rand((1, 3, 224, 224))
12model = DenseNet.densenet121()
13# first call .features, this will activate the forward hooks and tells the model you'll like to get the features
14model.encoder.features
15model(torch.randn((1,3,224,224)))
16# get the features from the encoder
17features = model.encoder.features
18print([x.shape for x in features])
19# [torch.Size([1, 128, 28, 28]), torch.Size([1, 256, 14, 14]), torch.Size([1, 512, 7, 7]), torch.Size([1, 1024, 7, 7])]