My implementation of Efficient-Net in nn.Sequence manner (i.e. without nn.Module) for feature extraction layers. This approach is more convinient for applying Class Activation Mapping or working with fast.ai library.
|
|
import efficientnet
model = efficientnet.efficientnet(net="B4", pretrained=True)
where B4 could be replaced with any model scale from B0 to B7. Weights will be downloaded automatically.
import efficientnet
image = torch.randn(1, 3, 300, 300)
model = efficientnet.efficientnet(net="B4", pretrained=True)
features = model.features(image)
In same way you can get output from any layer.
Weights were copied from here and adopted for my implementation.

