Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions module/pre_model_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ class model_extractor(nn.Module):
- fix_weights (bool): If True, freeze the weights of the extracted layers to prevent training.
"""
def __init__(self, arch, num_layers, fix_weights):
# Initialize the model_extractor class and its parent class nn.Module
super(model_extractor, self).__init__()
# Load the specified pretrained model
if arch.startswith('alexnet') :
# If the architecture is 'alexnet', load the AlexNet pretrained model
original_model = pre_models.alexnet(pretrained=True)
elif arch.startswith('resnet') :
original_model = pre_models.resnet18(pretrained=True)
Expand Down