Pytorch_Realtime_Multi-Person_Pose_Estimation icon indicating copy to clipboard operation
Pytorch_Realtime_Multi-Person_Pose_Estimation copied to clipboard

Sorry, please Python3 version

Open ghost opened this issue 6 years ago • 6 comments

Hi,

When I run test_pose.py, I get this error: TypeError: 'dict_keys' object does not support indexing

So, I changed "one_layer.keys()[0]" to "list(one_layer.keys())[0]". But, I get new error: KeyError: 'unexpected key "0.weight" in state_dict'

My Python's version is 3 and anaconda's version is 3. So, Please code of python3 version or solution.

Thank you

ghost avatar Nov 23 '17 06:11 ghost

Based on the error message, I think the problem is not relevant to the version. Obviously, you have gotten the keys, which are just different from the keys of the test model.

If you use the caffe2pytorch model to test, you should change the line 38 of test_pose.py from name = k[7:] to name = k.

If not, please debug~

last-one avatar Nov 23 '17 06:11 last-one

Thanks for your quick response.

I used the model in Google Drive to test. Could you tell me where I should change.

ghost avatar Nov 23 '17 06:11 ghost

Sorry, I changed the line 38 of test_pose.py from name = k[7:] to name = k and the error vanished.

But, I get other error: Traceback (most recent call last): File "test_pose.py", line 320, in canvas = process(model, input_image) File "test_pose.py", line 100, in process mask = np.ones((1, 1, input_img.shape[2] / stride, input_img.shape[3] / stride), dtype=np.float32) File "/home/usr/.pyenv/versions/anaconda3-5.0.1/lib/python3.6/site-packages/numpy/core/numeric.py", line 192, in ones a = empty(shape, dtype, order) TypeError: 'float' object cannot be interpreted as an integer

ghost avatar Nov 23 '17 06:11 ghost

Maybe you can try change mask = np.ones((1, 1, input_img.shape[2] / stride, input_img.shape[3] / stride), dtype=np.float32) from mask = np.ones((1, 1, int(input_img.shape[2] / stride), int(input_img.shape[3] / stride)), dtype=np.float32)

But I'm not sure. I don't know the rule of python3 or your numpy.

last-one avatar Nov 23 '17 08:11 last-one

I did not get the error. Thenk you very mach

ghost avatar Nov 23 '17 08:11 ghost

Hi,

I just ran the pose_estimation.py to do sanity check and I also got this error.

  File "hand_net.py", line 180, in <module>
    print(PoseModel(19, 6, True, False))
  File "hand_net.py", line 155, in PoseModel
    model = Pose_Estimation(net_dict, batch_norm)
  File "hand_net.py", line 15, in __init__
    self.model0 = self._make_layer(net_dict[0], batch_norm, True)
  File "hand_net.py", line 50, in _make_layer
    key = one_layer.keys()[0]
TypeError: 'dict_keys' object does not support indexing

After I change key = one_layer.keys()[0] to key = list(one_layer.keys())[0], I then got

    print(PoseModel(19, 6, True, False))
  File "hand_net.py", line 155, in PoseModel
    model = Pose_Estimation(net_dict, batch_norm)
  File "hand_net.py", line 20, in __init__
    self.model2_1 = self._make_layer(net_dict[2][0], batch_norm)
IndexError: list index out of range

Any idea what's going on here? Thanks!

pharrellyhy avatar Sep 12 '18 07:09 pharrellyhy