Spaces:
Sleeping
Sleeping
File size: 569 Bytes
9bf4bd7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
from typing import Dict
import mmengine
from mmocr.registry import DATA_DUMPERS
from .base import BaseDumper
@DATA_DUMPERS.register_module()
class JsonDumper(BaseDumper):
"""Dumper for json file."""
def dump(self, data: Dict) -> None:
"""Dump data to json file.
Args:
data (Dict): Data to be dumped.
"""
filename = f'{self.task}_{self.split}.json'
dst_file = osp.join(self.data_root, filename)
mmengine.dump(data, dst_file)
|