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

json.decoder error (Mediapipe) #178

Closed
Vinayky86 opened this issue Jul 28, 2022 · 11 comments
Closed

json.decoder error (Mediapipe) #178

Vinayky86 opened this issue Jul 28, 2022 · 11 comments

Comments

@Vinayky86
Copy link

Hello.. thanks for this amazing development..
I was trying to use mediapipe for MV1P and i followed these steps
1 - python apps/preprocess/extract_image.py 0_input\project
2 - python apps/preprocess/extract_keypoints.py 0_input\project --mode mp-pose
and
3 - python apps/demo/mv1p.py 0_input/project --out 1_output/project --vis_det --vis_repro --sub_vis 1 2 3 4 --vis_smpl

but when i run 3rd steps (mv1p.py), getting this error

Traceback (most recent call last):
File "apps/demo/mv1p.py", line 117, in
mv1pmf_skel(dataset, check_repro=True, args=args)
File "apps/demo/mv1p.py", line 35, in mv1pmf_skel
images, annots = dataset[nf]
File "c:\mocap\easymocap\easymocap\dataset\mv1pmf.py", line 72, in getitem
images, annots_all = super().getitem(index)
File "c:\mocap\easymocap\easymocap\dataset\base.py", line 482, in getitem
annot = read_annot(annname, self.kpts_type)
File "c:\mocap\easymocap\easymocap\mytools\file_utils.py", line 46, in read_annot
data = read_json(annotname)
File "c:\mocap\easymocap\easymocap\mytools\file_utils.py", line 19, in read_json
data = json.load(f)
File "C:\Users\Vinayky86\anaconda3\envs\easymocap\lib\json_init_.py", line 296, in load
parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
File "C:\Users\Vinayky86\anaconda3\envs\easymocap\lib\json_init_.py", line 348, in loads
return _default_decoder.decode(s)
File "C:\Users\Vinayky86\anaconda3\envs\easymocap\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\Vinayky86\anaconda3\envs\easymocap\lib\json\decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Invalid \escape: line 2 column 19 (char 20)

Please correct me if I am doing any wrong steps
thank you ...!!!

@chingswy
Copy link
Contributor

Hello, you can print the filename when the error occurs.

@Vinayky86
Copy link
Author

thanks for your response..!!
am i following the right steps..?
1 - python apps/preprocess/extract_image.py
2 - python apps/preprocess/extract_keypoints.py
3 - python apps/demo/mv1p.py

"Actully i don't know lot of things about coading,
can you please direct me what is the main reason of this error"
thanks a lot..!!

@chingswy
Copy link
Contributor

Seems the file is corrupted. You can remove the annots folder and generate again.

@Vinayky86
Copy link
Author

thanks...
i did this step around 4 times delete and regenerate the annots. but nothing happened.
but i found little difference in mediapipe's annots
in openpose annots - "filename": "images\1\000000.jpg",
in mediapipe annots - "filename": "1\000000.jpg",
can it cause the Json.decoder error..?

@chingswy
Copy link
Contributor

No. This won't cause the decode error.

@Vinayky86
Copy link
Author

Ok thanks for your reply..!!! I will try

@NishilVani
Copy link

NishilVani commented Aug 3, 2022

The Problem is in the JSON files there should be two \ in the filename but there is only one

run this command for each camera

import os

os.chdir(r'path\to\json\folder')

for fp in os.listdir('.'):
    if fp.endswith('.json'):
        f = open(fp, 'r+')
        content = f.read()
        f.seek(0)
        f.truncate()

        f.write(content[:26] + r"\\" + content[27:])
        f.close()

@chingswy
Copy link
Contributor

chingswy commented Aug 3, 2022

Thanks @NishilVani . Maybe it's a bug in windows? I didn't test the code on Windows now.

@Vinayky86
Copy link
Author

Thank you very much @NishilVani your code successfully convert .json file for each cameras, but easymocap giving same jsondecoder error. BTW thanks again for your help you are very kind, really appreciate 🙏🙏

@ferhatsb
Copy link

Probably related to #198

@Vinayky86
Copy link
Author

Thank you very much @ferhatsb exactly..👌you have solved the problem..👏👏❤️

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

4 participants