deep learning - How to add the last classification layer in ...
stackoverflow.com › questions › 68047331Jun 19, 2021 · EfficentNet class doesn't have attribute classifier, you need to change in_features=model.classifier.in_features to in_features=model._fc.in_features.. import torchvision.models as models NUM_CLASSES = 4 #EfficientNet from efficientnet_pytorch import EfficientNet efficientnet = EfficientNet.from_pretrained('efficientnet-b3') efficientnet ._fc= torch.nn.Linear(in_features=efficientnet._fc.in ...