File size: 1,235 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
26
27
28
29
30
31
32
33
34
35
36
# Copyright (c) OpenMMLab. All rights reserved.
from typing import Any


class BaseDumper:
    """Base class for data dumpers.

    Args:
        task (str): Task type. Options are 'textdet', 'textrecog',
            'textspotter', and 'kie'. It is usually set automatically and users
             do not need to set it manually in config file in most cases.
        split (str): It' s the partition of the datasets. Options are 'train',
            'val' or 'test'. It is usually set automatically and users do not
            need to set it manually in config file in most cases. Defaults to
            None.
        data_root (str): The root directory of the image and
            annotation. It is usually set automatically and users do not need
            to set it manually in config file in most cases. Defaults to None.
    """

    def __init__(self, task: str, split: str, data_root: str) -> None:
        self.task = task
        self.split = split
        self.data_root = data_root

    def __call__(self, data: Any) -> None:
        """Call function.

        Args:
            data (Any): Data to be dumped.
        """
        self.dump(data)

    def dump(self, data: Any) -> None:
        raise NotImplementedError