bug fix: Remove the NUL character at the end to avoid JSONDecodeError#64
Open
keepcreative wants to merge 1 commit intotylin:masterfrom
Open
bug fix: Remove the NUL character at the end to avoid JSONDecodeError#64keepcreative wants to merge 1 commit intotylin:masterfrom
keepcreative wants to merge 1 commit intotylin:masterfrom
Conversation
Remove the NUL character at the end to avoid JSONDecodeError
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Remove the NUL character at the end to avoid JSONDecodeError
the code before may cause the error below:
Traceback (most recent call last):
File "/path/to/evaluate.py", line 65, in
eval_res = evaluate_metrics_from_lists(gen_captions, true_captions)
File "/path/to/caption_evaluation_tools/eval_metrics.py", line 156, in evaluate_metrics_from_lists
metrics, per_file_metrics = evaluate_metrics_from_files(
File "/path/to/caption_evaluation_tools/eval_metrics.py", line 102, in evaluate_metrics_from_files
cocoEval.evaluate()
File "/path/to/caption_evaluation_tools/coco_caption/pycocoevalcap/eval.py", line 72, in evaluate
score, scores = scorer.compute_score(gts, res)
File "/path/to/caption_evaluation_tools/coco_caption/pycocoevalcap/spice/spice.py", line 79, in compute_score
results = json.load(data_file)
File "/path/to/miniconda3/envs/myenv/lib/python3.9/json/init.py", line 293, in load
return loads(fp.read(),
File "/path/to/miniconda3/envs/myenv/lib/python3.9/json/init.py", line 346, in loads
return _default_decoder.decode(s)
File "/path/to/miniconda3/envs/myenv/lib/python3.9/json/decoder.py", line 340, in decode
raise JSONDecodeError("Extra data", s, end)
json.decoder.JSONDecodeError: Extra data: line 71062 column 2 (char 1260980)
where the 'Extra data: line 71062 column 2' is actually a NUL symbol.