I am training a flower classifier and in order to increase the performance, I want to add 3 layers to the feature extracted by the pre-trained Inception v3 model and calculate the confusion matrix.
The three-layers are -
- An average pooling layer followed by
- 2 Dense Layers (512)
I would really appreciate if you can help me with it.
model_ft = models.inception_v3(pretrained=True) model_ft.aux_logits=False # I want to add the layers here num_ftrs = model_ft.fc.in_features model_ft.fc = nn.Linear(num_ftrs, 102) model_ft = model_ft.to(device) criterion = nn.CrossEntropyLoss() optimizer_ft = optim.SGD(model_ft.parameters(), lr=0.001, momentum=0.9) exp_lr_scheduler = lr_scheduler.StepLR(optimizer_ft, step_size=10, gamma=0.1)