last-one / Pytorch_Realtime_Multi-Person_Pose_Estimation

Pytorch version of Realtime Multi-Person Pose Estimation project
MIT License
216 stars 70 forks source link

Sorry, please Python3 version #3

Open ghost opened 6 years ago

ghost commented 6 years ago

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

last-one commented 6 years ago

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~

ghost commented 6 years ago

Thanks for your quick response.

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

ghost commented 6 years ago

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

last-one commented 6 years ago

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.

ghost commented 6 years ago

I did not get the error. Thenk you very mach

pharrellyhy commented 5 years ago

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!