File size: 907 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
# Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
from typing import Tuple

from mmocr.registry import DATA_GATHERERS
from .base import BaseGatherer


@DATA_GATHERERS.register_module()
class MonoGatherer(BaseGatherer):
    """Gather the dataset file. Specifically for the case that only one
    annotation file is needed. For example,

            img_001.jpg \
            img_002.jpg ---> train.json
            img_003.jpg /

    Args:
        ann_name (str): The name of the annotation file.
    """

    def __init__(self, ann_name: str, **kwargs) -> None:
        super().__init__(**kwargs)

        self.ann_name = ann_name

    def __call__(self) -> Tuple[str, str]:
        """
        Returns:
            tuple(str, str): The directory of the image and the path of
            annotation file.
        """

        return (self.img_dir, osp.join(self.ann_dir, self.ann_name))