mkocabas / EpipolarPose

Self-Supervised Learning of 3D Human Pose using Multi-view Geometry (CVPR2019)
Other
597 stars 97 forks source link

test on CPU #11

Closed Ariel-JUAN closed 5 years ago

Ariel-JUAN commented 5 years ago

sorry, I have solved the problem.

bpeck81 commented 5 years ago

I am unable to validate with cpu. When I change demo.py to load the fully_supervised.pth.tar weights by changing checkpoint = torch.load(config.MODEL.RESUME, map_location='cpu')

I get the following error: RuntimeError: Error(s) in loading state_dict for PoseResNet: Missing key(s) in state_dict

bpeck81 commented 5 years ago

I got it to work with a few tweaks. I added this code in create model section of demo.py

checkpoint = torch.load(config.MODEL.RESUME, map_location='cpu')
i = 0
keys = list(checkpoint.keys())
while i < len(keys):
    checkpoint[keys[i].replace("module.","")] = checkpoint[keys[i]]
    del checkpoint[keys[i]]
    i+=1
model.load_state_dict(checkpoint)

And I changed lines 61-63 in integral_loss.py to

 accu_x = accu_x * torch.arange(float(x_dim)) #torch.cuda.comm.broadcast(torch.arange(float(x_dim)), devices=[accu_x.device.index])[0]
    accu_y = accu_y * torch.arange(float(y_dim))#torch.cuda.comm.broadcast(torch.arange(float(y_dim)), devices=[accu_y.device.index])[0]
    accu_z = accu_z * torch.arange(float(z_dim))#torch.cuda.comm.broadcast(torch.arange(float(z_dim)), devices=[accu_z.device.index])[0]