Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error Running Image Demo #18

Closed
mrciolino opened this issue Jul 5, 2019 · 8 comments
Closed

Error Running Image Demo #18

mrciolino opened this issue Jul 5, 2019 · 8 comments

Comments

@mrciolino
Copy link

mrciolino commented Jul 5, 2019

(pose) λ python image_demo.py --model 101 --image_dir ./images --output_dir ./output
2019-07-05 11:32:41.033388: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2
2019-07-05 11:32:41.252994: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1433] Found device 0 with properties:
name: Quadro P620 major: 6 minor: 1 memoryClockRate(GHz): 1.354
pciBusID: 0000:01:00.0
totalMemory: 2.00GiB freeMemory: 1.61GiB
2019-07-05 11:32:41.277022: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1512] Adding visible gpu devices: 0
2019-07-05 11:32:41.660454: I tensorflow/core/common_runtime/gpu/gpu_device.cc:984] Device interconnect StreamExecutor with strength 1 edge matrix:
2019-07-05 11:32:41.675743: I tensorflow/core/common_runtime/gpu/gpu_device.cc:990] 0
2019-07-05 11:32:41.685065: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1003] 0: N
2019-07-05 11:32:41.695527: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 1353 MB memory) -> physical GPU (device: 0, name: Quadro P620, pci bus id: 0000:01:00.0, compute capability: 6.1)
C:\Users\user\folder\Desktop\Atom Files\AI Files\Demos\posenet-python-master\posenet\converter\config.py:9: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
cfg = yaml.load(cfg_f)
Cannot find model file ./models\model-mobilenet_v1_101.pb, converting from tfjs...
Traceback (most recent call last):
File "image_demo.py", line 74, in
main()
File "image_demo.py", line 22, in main
model_cfg, model_outputs = posenet.load_model(args.model, sess)
File "C:\Users\user\folder\Desktop\Atom Files\AI Files\Demos\posenet-python-master\posenet\model.py", line 42, in load_model
convert(model_ord, model_dir, check=False)
File "C:\Users\user\folder\Desktop\Atom Files\AI Files\Demos\posenet-python-master\posenet\converter\tfjs2python.py", line 164, in convert
variables = load_variables(chkpoint)
File "C:\Users\user\folder\Desktop\Atom Files\AI Files\Demos\posenet-python-master\posenet\converter\tfjs2python.py", line 54, in load_variables
variables = json.load(f)
File "C:\Users\user\AppData\Local\conda\conda\envs\pose\lib\json_init
.py", line 296, in load
return loads(fp.read(),
File "C:\Users\user\AppData\Local\conda\conda\envs\pose\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x8f in position 72: character maps to

Package List
Name Version Build Channel
_tflow_select 2.1.0 gpu
absl-py 0.7.1 py36_0
astor 0.7.1 py36_0
blas 1.0 mkl
ca-certificates 2019.5.15 0
certifi 2019.6.16 py36_0
cudatoolkit 9.0 1
cudnn 7.6.0 cuda9.0_0
gast 0.2.2 py36_0
grpcio 1.16.1 py36h351948d_1
h5py 2.9.0 py36h5e291fa_0
hdf5 1.10.4 h7ebc959_0
icc_rt 2019.0.0 h0cc432a_1
intel-openmp 2019.4 245
keras-applications 1.0.8 py_0
keras-preprocessing 1.1.0 py_1
libprotobuf 3.8.0 h7bd577a_0
markdown 3.1.1 py36_0
mkl 2019.4 245
mkl_fft 1.0.12 py36h14836fe_0
mkl_random 1.0.2 py36h343c172_0
mock 3.0.5 py36_0
numpy 1.16.4 py36h19fb1c0_0
numpy-base 1.16.4 py36hc3f5095_0
opencv-python 3.4.5.20
openssl 1.1.1c he774522_1
pip 19.1.1 py36_0
protobuf 3.8.0 py36h33f27b4_0
pyreadline 2.1 py36_1
python 3.6.8 h9f7ef89_7
pyyaml 5.1.1 py36he774522_0
scipy 1.2.1 py36h29ff71c_0
setuptools 41.0.1 py36_0
six 1.12.0 py36_0
sqlite 3.28.0 he774522_0
tensorboard 1.13.1 py36h33f27b4_0
tensorflow 1.13.1 gpu_py36h1635174_0
tensorflow-base 1.13.1 gpu_py36h0fff12a_0
tensorflow-estimator 1.13.0 py_0
tensorflow-gpu 1.13.1 h0d30ee6_0
termcolor 1.1.0 py36_1
vc 14.1 h21ff451_3 anaconda
vs2015_runtime 15.5.2 3 anaconda
werkzeug 0.15.4 py_0
wheel 0.33.4 py36_0
wincertstore 0.2 py36h7fe50ca_0
yaml 0.1.7 hc54c509_2
zlib 1.2.11 h62dcd97_3

@rwightman
Copy link
Owner

Are your paths exactly as you showed or did you change them? It may be unicode characters in a path if user\folder are not as shown or some other issue caused by combination of Windows + non-English region...

@mrciolino
Copy link
Author

I changed the showed path for privacy. Yes, the path has spaces, hyphens and a period. I'll see if changing that works. That will most likely solve this problem.

@Padu0827
Copy link

Padu0827 commented Jul 8, 2019

I'm having the same issue but my paths don't have any illegal characters. It looks to me like there's an error decoding the json file containing the model save using the cp1252 encoding.

@rwightman
Copy link
Owner

@Padu0827 I assume you're on Windows as well? I don't currently have regular access to a Windows machine, I tested once and it seemed to work, others have reported success as well.

Could both of you try this, at this location in the code https://github.com/rwightman/posenet-python/blob/master/posenet/converter/tfjs2python.py#L53

Change:

    f = open(manifest_path)
    variables = json.load(f)
    f.close()

To:

    with open(manifest_path, encoding='utf8') as f:
        variables = json.load(f)

@Padu0827
Copy link

Padu0827 commented Jul 8, 2019

After making that change I'm now receiving this error
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte

@mrciolino
Copy link
Author

Hi changed my files paths and changed that those lines. Same error:

D:\test\posenet-python\posenet\converter\config.py:9: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
cfg = yaml.load(cfg_f)
Cannot find model file ./models\model-mobilenet_v1_101.pb, converting from tfjs...
Traceback (most recent call last):
File "image_demo.py", line 74, in
main()
File "image_demo.py", line 22, in main
model_cfg, model_outputs = posenet.load_model(args.model, sess)
File "D:\test\posenet-python\posenet\model.py", line 42, in load_model
convert(model_ord, model_dir, check=False)
File "D:\test\posenet-python\posenet\converter\tfjs2python.py", line 163, in convert
variables = load_variables(chkpoint)
File "D:\test\posenet-python\posenet\converter\tfjs2python.py", line 54, in load_variables
variables = json.load(f)
File "C:\Users\matt.ciolino\AppData\Local\conda\conda\envs\pose\lib\json_init
.py", line 296, in load
return loads(fp.read(),
File "C:\Users\first.last\AppData\Local\conda\conda\envs\pose\lib\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

@rwightman
Copy link
Owner

Was broken on linux as well. It looks like the storage server was changed so that the JSON files were always gzip encoded. I think the last commit should fix things on both OS.

@rwightman
Copy link
Owner

@mrciolino @Padu0827 after updating to the latest commit, you'll have to find the temp folder and delete...

Usually something like this on windows but can change if you define diff temp: C:\Users\user\AppData\Local\Temp\_posenet_weights

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants