Views
No views yet
state_dict) for an InceptionV3 model fine-tuned to detect forest fires from ground-level images.1import torch
2import torch.nn as nn
3from torchvision.models import inception_v3
4
5# Create the model architecture
6model = inception_v3(weights=None, aux_logits=True)
7
8# Replace the main classifier
9model.fc = nn.Linear(model.fc.in_features, 2)
10
11# Replace the auxiliary classifier
12model.AuxLogits.fc = nn.Linear(
13 model.AuxLogits.fc.in_features,
14 2
15)
16
17# Load the state dictionary
18state_dict = torch.load(
19 "inceptionv3.pt",
20 map_location="cpu"
21)
22
23model.load_state_dict(state_dict)
24model.eval()