leoxiaobin / deep-high-resolution-net.pytorch

The project is an official implementation of our CVPR2019 paper "Deep High-Resolution Representation Learning for Human Pose Estimation"
https://jingdongwang2017.github.io/Projects/HRNet/PoseEstimation.html
MIT License
4.32k stars 910 forks source link

Two JSONDecodeError, how to solve it? #178

Open hithqd opened 4 years ago

hithqd commented 4 years ago

When I follow the guide and train on coco using "python tools/train.py --cfg experiments/coco/hrnet/w32_256x192_adam_lr1e-3.yaml ",there are two errors:

Traceback (most recent call last): File "tools/train.py", line 223, in main() File "tools/train.py", line 130, in main normalize, File "/media/vision/5f9d107c-6637-4a86-aaee-56d5d628daf8/haidifan/deep-high-resolution-net.pytorch/tools/../lib/dataset/coco.py", line 68, in init self.coco = COCO(self._get_ann_file_keypoint()) File "/home/vision/.local/lib/python3.6/site-packages/pycocotools-2.0-py3.6-linux-x86_64.egg/pycocotools/coco.py", line 86, in init dataset = json.load(open(annotation_file, 'r')) File "/home/vision/anaconda3/envs/HRNet/lib/python3.6/json/init.py", line 299, in load parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw) File "/home/vision/anaconda3/envs/HRNet/lib/python3.6/json/init.py", line 354, in loads return _default_decoder.decode(s) File "/home/vision/anaconda3/envs/HRNet/lib/python3.6/json/decoder.py", line 339, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/home/vision/anaconda3/envs/HRNet/lib/python3.6/json/decoder.py", line 355, in raw_decode obj, end = self.scan_once(s, idx) json.decoder.JSONDecodeError: Invalid control character at: line 1 column 10452993 (char 10452992)

**Then I tried to change the code in coco.py: from dataset = json.load(open(annotation_file, 'r')) to dataset = json.load(open(annotation_file, 'r'),strict=False)

But there is another error:**

Traceback (most recent call last):
File "tools/train.py", line 223, in
main()
File "tools/train.py", line 130, in main
normalize, File "/media/vision/5f9d107c-6637-4a86-aaee-56d5d628daf8/haidifan/deep-high-resolution-net.pytorch/tools/../lib/dataset/coco.py", line 68, in init
self.coco = COCO(self._get_ann_file_keypoint()) File "/home/vision/.local/lib/python3.6/site-packages/pycocotools-2.0-py3.6-linux-x86_64.egg/pycocotools/coco.py", line 86, in init
dataset = json.load(open(annotation_file, 'r'),strict=False)
File "/home/vision/anaconda3/envs/HRNet/lib/python3.6/json/init.py", line 299, in load
parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, kw) File "/home/vision/anaconda3/envs/HRNet/lib/python3.6/json/init.py", line 367, in loads
return cls(
kw).decode(s)
File "/home/vision/anaconda3/envs/HRNet/lib/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/home/vision/anaconda3/envs/HRNet/lib/python3.6/json/decoder.py", line 355, in raw_decode obj, end = self.scan_once(s, idx) json.decoder.JSONDecodeError: Expecting ',' delimiter: line 1 column 10485768 (char 10485767)

How to solve them?

anas-zafar commented 1 year ago

@hithqd were you able to solve the issue?