"jsondecode" poor performance in COCO datasets?
3 次查看(过去 30 天)
显示 更早的评论
I tried to import data annotation files from COCO2017 and it takes about half a minute using “jsondecode”, while coco-api only takes about 15 seconds, can the performance of “jsondecode” be significantly provided in future versions?
Run R2021a,
cocoDir = 'coco2017/';
annFile = 'annotations_trainval2017\annotations\instances_train2017.json';
annFile = fullfile(cocoDir,annFile);
data = fileread(annFile);
tic
data = jsondecode(data);
toc
Elapsed time is 31.671089 seconds.
cocoDir = 'coco2017/';
annFile = 'annotations_trainval2017\annotations\instances_train2017.json';
annFile = fullfile(cocoDir,annFile);
tic
coco=CocoApi(annFile);
toc
Elapsed time is 15.598371 seconds.
1 个评论
Rik
2021-8-5
Performance is strongly dependent on the implementation or the JSON parser. In the performance section (direct link, might break after an update) of the documentation for my JSON parser you can see there is a quite a wide margin.
For a very large file jsondecode is much faster (1000x), while for many small files my parser is faster (2-3x).
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 JSON Format 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!