You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the recognition model test, the following error is reported:
File "tools/test.py", line 235, in
main()
File "tools/test.py", line 204, in main
outputs = single_gpu_test(model, data_loader, args.show, args.show_dir,
File "/root/mmocr/mmocr/apis/test.py", line 72, in single_gpu_test
for data in data_loader:
File "/root/miniconda3/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 521, in next
data = self._next_data()
File "/root/miniconda3/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1203, in _next_data
return self._process_data(data)
File "/root/miniconda3/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1229, in _process_data
data.reraise()
File "/root/miniconda3/lib/python3.8/site-packages/torch/_utils.py", line 433, in reraise
raise RuntimeError(msg) from None
RuntimeError: Caught JSONDecodeError in DataLoader worker process 0.
Original Traceback (most recent call last):
File "/root/miniconda3/lib/python3.8/site-packages/torch/utils/data/_utils/worker.py", line 287, in _worker_loop
data = fetcher.fetch(index)
File "/root/miniconda3/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 49, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/root/miniconda3/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 49, in
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/root/miniconda3/lib/python3.8/site-packages/torch/utils/data/dataset.py", line 308, in getitem
return self.datasets[dataset_idx][sample_idx]
File "/root/mmocr/mmocr/datasets/base_dataset.py", line 141, in getitem
return self.prepare_test_img(index)
File "/root/mmocr/mmocr/datasets/base_dataset.py", line 113, in prepare_test_img
return self.prepare_train_img(img_info)
File "/root/mmocr/mmocr/datasets/base_dataset.py", line 98, in prepare_train_img
img_info = self.data_infos[index]
File "/root/mmocr/mmocr/datasets/utils/loader.py", line 65, in getitem
return self.parser.get_item(self.ori_data_infos, index)
File "/root/mmocr/mmocr/datasets/utils/parser.py", line 75, in get_item
line_json_obj = json.loads(json_str)
File "/root/miniconda3/lib/python3.8/json/init.py", line 357, in loads
return _default_decoder.decode(s)
File "/root/miniconda3/lib/python3.8/json/decoder.py", line 340, in decode
raise JSONDecodeError("Extra data", s, end)
json.decoder.JSONDecodeError: Extra data: line 1 column 5 (char 4)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
When using the recognition model test, the following error is reported:
File "tools/test.py", line 235, in
main()
File "tools/test.py", line 204, in main
outputs = single_gpu_test(model, data_loader, args.show, args.show_dir,
File "/root/mmocr/mmocr/apis/test.py", line 72, in single_gpu_test
for data in data_loader:
File "/root/miniconda3/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 521, in next
data = self._next_data()
File "/root/miniconda3/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1203, in _next_data
return self._process_data(data)
File "/root/miniconda3/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1229, in _process_data
data.reraise()
File "/root/miniconda3/lib/python3.8/site-packages/torch/_utils.py", line 433, in reraise
raise RuntimeError(msg) from None
RuntimeError: Caught JSONDecodeError in DataLoader worker process 0.
Original Traceback (most recent call last):
File "/root/miniconda3/lib/python3.8/site-packages/torch/utils/data/_utils/worker.py", line 287, in _worker_loop
data = fetcher.fetch(index)
File "/root/miniconda3/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 49, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/root/miniconda3/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 49, in
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/root/miniconda3/lib/python3.8/site-packages/torch/utils/data/dataset.py", line 308, in getitem
return self.datasets[dataset_idx][sample_idx]
File "/root/mmocr/mmocr/datasets/base_dataset.py", line 141, in getitem
return self.prepare_test_img(index)
File "/root/mmocr/mmocr/datasets/base_dataset.py", line 113, in prepare_test_img
return self.prepare_train_img(img_info)
File "/root/mmocr/mmocr/datasets/base_dataset.py", line 98, in prepare_train_img
img_info = self.data_infos[index]
File "/root/mmocr/mmocr/datasets/utils/loader.py", line 65, in getitem
return self.parser.get_item(self.ori_data_infos, index)
File "/root/mmocr/mmocr/datasets/utils/parser.py", line 75, in get_item
line_json_obj = json.loads(json_str)
File "/root/miniconda3/lib/python3.8/json/init.py", line 357, in loads
return _default_decoder.decode(s)
File "/root/miniconda3/lib/python3.8/json/decoder.py", line 340, in decode
raise JSONDecodeError("Extra data", s, end)
json.decoder.JSONDecodeError: Extra data: line 1 column 5 (char 4)
my dataset config:
dataset_type = 'OCRDataset'
root = 'data/iiit5k'
train_anno_file1 = f'{root}/train_label.txt'
train1 = dict(
type=dataset_type,
img_prefix=f'{root}/imgs/train',
ann_file=train_anno_file1,
loader=dict(
type='AnnFileLoader',
repeat=100,
file_format='txt',
file_storage_backend='disk',
parser=dict(
type='LineStrParser',
keys=['filename', 'text'],
keys_idx=[0, 1],
separator=' ')),
pipeline=None,
test_mode=False)
test_anno_file1 = f'{root}/test_label.txt'
test = dict(
type=dataset_type,
img_prefix=f'{root}/imgs/test',
ann_file=test_anno_file1,
loader=dict(
type='AnnFileLoader',
repeat=1,
file_format='txt',
file_storage_backend='disk',
parser=dict(type='LineJsonParser', keys=['filename', 'text'])),
pipeline=None,
test_mode=True)
train_list = [train1]
test_list = [test]
Is it a problem with labeling documents, I hope to get some suggestions.Thanks.
Beta Was this translation helpful? Give feedback.
All reactions