File size: 771 Bytes
4187c6f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from ..base import DataBase
from .dataset import NuScenesDataset
from ..schema import NuScenesDataConfiguration

class NuScenesData(DataBase):
    def __init__(self, cfg: NuScenesDataConfiguration):
        self.cfg = cfg
        self._dataset = {}

    def prepare_data(self):
        pass

    def setup(self, stage):
        if stage is None:
            stage = 'fit'

        split = {
            'fit': 'train',
            'val': 'val',
            'validate': 'val',
            'test': 'test'
        }[stage]

        self._dataset[split] = NuScenesDataset(
            split=split,
            cfg=self.cfg
        )

    def dataset(self, stage):
        if self._dataset.get(stage) is None:
            self.setup(stage)

        return self._dataset[stage]