JeVoisBase  1.22
JeVois Smart Embedded Machine Vision Toolkit Base Modules
Share this page:
Loading...
Searching...
No Matches
tracking.py
Go to the documentation of this file.
1import os
2import numpy as np
3
4from .base_dataloader import _BaseVideoLoader
5from ..factory import DATALOADERS
6
7@DATALOADERS.register
9 def __init__(self, **kwargs):
10 super().__init__(**kwargs)
11
12 self._first_frames = dict()
13 for filename in self._files:
14 stream = self._streams[filename]
15 self._first_frames[filename] = next(stream)
16
17 self._rois = self._load_roi()
18
19 def _load_roi(self):
20 rois = dict.fromkeys(self._files, None)
21 for filename in self._files:
22 rois[filename] = np.loadtxt(os.path.join(self._path, '{}.txt'.format(filename[:-4])), dtype=np.int32, ndmin=2)
23 return rois
24
25 def __getitem__(self, idx):
26 filename = self._files[idx]
27 return filename, self._streams[filename], self._first_frames[filename], self._rois[filename]