This file contains hidden or 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
| #!/home/adnan/anaconda3/bin/python | |
| import torch | |
| import torch.nn as nn | |
| import torch.optim as optim | |
| from torch.optim import lr_scheduler | |
| import torchvision | |
| from torchvision import datasets, models, transforms | |
| import time | |
| import os | |
| import copy |
This file contains hidden or 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
| model = load_model('/home/adnan/Datasets/Network-weights/FCN-Classifier-Light-CIFAR-10/Classifier_CIFAR10_FCN_light_trained_models-97-0.7636.h5') | |
| layer_outputs = [layer.output for layer in model.layers] | |
| activation_model = Model(inputs=model.input, outputs=layer_outputs) | |
| def get_activations(img): | |
| layer_activations = list() | |
| activations = activation_model.predict(img) |