rwightman / posenet-pytorch

A PyTorch port of Google TensorFlow.js PoseNet (Real-time Human Pose Estimation)
Apache License 2.0
307 stars 99 forks source link

'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte #5

Closed iharshgor closed 5 years ago

iharshgor commented 5 years ago

Everything was working fine before. after some time I've clone this repo again and try running the image_demo.py with the below command.

python3 image_demo.py --model 101 --image_dir ./images --output_dir ./output

but got the error

Cannot find models file ./_models/mobilenet_v1_050.pth, converting from tfjs...
Weights for checkpoint mobilenet_v1_050 are not downloaded. Downloading to /tmp/_posenet_weights ...
Traceback (most recent call last):
  File "image_demo.py", line 73, in <module>
    main()
  File "image_demo.py", line 20, in main
    model = posenet.load_model(args.model)
  File "/home/harsh/workspace/pose_esti/posenet-pytorch/posenet/models/model_factory.py", line 16, in load_model
    convert(model_id, model_dir, check=False)
  File "/home/harsh/workspace/pose_esti/posenet-pytorch/posenet/converter/tfjs2pytorch.py", line 93, in convert
    state_dict = load_variables(checkpoint_name)
  File "/home/harsh/workspace/pose_esti/posenet-pytorch/posenet/converter/tfjs2pytorch.py", line 49, in load_variables
    download(chkpoint, base_dir)
  File "/home/harsh/workspace/pose_esti/posenet-pytorch/posenet/converter/wget.py", line 24, in download
    json_dict = json.load(f)
  File "/home/harsh/anaconda3/envs/py36/lib/python3.6/json/__init__.py", line 296, in load
    return loads(fp.read(),
  File "/home/harsh/anaconda3/envs/py36/lib/python3.6/codecs.py", line 321, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte
iharshgor commented 5 years ago

So I found that the issue was from google side it was sending the wrong JSON. now everything is working normally so I'm closing the issue.

srego commented 5 years ago

@harshmgor Can you please advise on how you fixed the issue? Thanks!

soheilysf commented 5 years ago

@harshmgor I am having the same issue, could you please explain how you made it work?

soheilysf commented 5 years ago

@srego refer to this PR if you are still having issues: https://github.com/rwightman/posenet-pytorch/pull/6