Hi,
I have my model like this
from hrnet import HRNet
Model = HRNet(in_c, out_c )
class modyfied_model():
def __init__(self, backbone):
super(new_model, self).__init__()
self.backbone = backbone
self.conv1 = nn.Conv2d(128,64,3,2, padding=1)
self.conv2 = nn.Conv2d(64,50,3,2, padding=1)
self.conv3 = nn.Conv2d(50,50,3,2, padding=1)
def forward(self, x):
x = self.backbone(x)
x = self.conv1(x)
#print(x.shape)
x = self.conv2(x)
#print(x.shape)
x = self.conv3(x)
#print(x.shape)
#x = self.max_pool(x)
#print(x.shape)
x = x.view(2,25,1024)
#print(x.shape)
#x = self.flatten(x)
#coord_x = self.pred_x(x)
coord_x = x[0,:,:].reshape(1,25,1024)
#print(coord_x.shape)
#coord_y = self.pred_y(x)
coord_y = x[1,:,:].reshape(1,25,1024)
#print(coord_y.shape)
return coord_x, coord_y
new_model = modified_model(Model)
… training and saving the state dictionary
for inference I use the same model
Model = HRNet(in, out)
modified_model()…
test_model = modified_model(Model)
PATH = ‘path/to/checkpoint/’
checkpoint = torch.load(PATH,map_location=torch.device(‘cpu’))
model.load_state_dict(checkpoint[‘state_dict’])
now it is giving error missing keys…