| 125 | from torch.nn.functional import adaptive_avg_pool2d |
| 126 | |
| 127 | class InceptionV3(nn.Module): |
| 128 | def __init__(self): |
| 129 | super().__init__() |
| 130 | model = inception_v3(weights='IMAGENET1K_V1', transform_input=False) |
| 131 | model.fc = nn.Identity() |
| 132 | model.aux_logits = False |
| 133 | self.model = model |
| 134 | |
| 135 | def forward(self, x): |
| 136 | x = nn.functional.interpolate(x, size=(299, 299), mode='bilinear', align_corners=False) |
| 137 | return self.model(x) |
| 138 | |
| 139 | def get_activations(path, model, batch_size, dims, device, num_workers): |
| 140 | model.eval() |
no outgoing calls