(self, in_dim, weights_file, bias_file, model_data_dir)
| 30 | |
| 31 | class FinetuneFasterRcnnFpnFc7(nn.Module): |
| 32 | def __init__(self, in_dim, weights_file, bias_file, model_data_dir): |
| 33 | super(FinetuneFasterRcnnFpnFc7, self).__init__() |
| 34 | pythia_root = get_pythia_root() |
| 35 | model_data_dir = os.path.join(pythia_root, model_data_dir) |
| 36 | |
| 37 | if not os.path.isabs(weights_file): |
| 38 | weights_file = os.path.join(model_data_dir, weights_file) |
| 39 | if not os.path.isabs(bias_file): |
| 40 | bias_file = os.path.join(model_data_dir, bias_file) |
| 41 | with open(weights_file, "rb") as w: |
| 42 | weights = pickle.load(w) |
| 43 | with open(bias_file, "rb") as b: |
| 44 | bias = pickle.load(b) |
| 45 | out_dim = bias.shape[0] |
| 46 | |
| 47 | self.lc = nn.Linear(in_dim, out_dim) |
| 48 | self.lc.weight.data.copy_(torch.from_numpy(weights)) |
| 49 | self.lc.bias.data.copy_(torch.from_numpy(bias)) |
| 50 | self.out_dim = out_dim |
| 51 | |
| 52 | def forward(self, image): |
| 53 | i2 = self.lc(image) |
nothing calls this directly
no test coverage detected