MCPcopy Create free account
hub / github.com/akira-l/SEEG / run

Method run

scripts/data_loader/data_preprocessor.py:39–67  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

37 self.n_out_samples = 0
38
39 def run(self):
40 n_filtered_out = defaultdict(int)
41 src_txn = self.src_lmdb_env.begin(write=False)
42
43 # sampling and normalization
44 cursor = src_txn.cursor()
45 for key, value in cursor:
46 video = pyarrow.deserialize(value)
47 vid = video['vid']
48 clips = video['clips']
49 for clip_idx, clip in enumerate(clips):
50 filtered_result = self._sample_from_clip(vid, clip)
51 for type in filtered_result.keys():
52 n_filtered_out[type] += filtered_result[type]
53
54 # print stats
55 with self.dst_lmdb_env.begin() as txn:
56 print('no. of samples: ', txn.stat()['entries'])
57 n_total_filtered = 0
58 for type, n_filtered in n_filtered_out.items():
59 print('{}: {}'.format(type, n_filtered))
60 n_total_filtered += n_filtered
61 print('no. of excluded samples: {} ({:.1f}%)'.format(
62 n_total_filtered, 100 * n_total_filtered / (txn.stat()['entries'] + n_total_filtered)))
63
64 # close db
65 self.src_lmdb_env.close()
66 self.dst_lmdb_env.sync()
67 self.dst_lmdb_env.close()
68
69 def _sample_from_clip(self, vid, clip):
70 clip_skeleton = clip['skeletons_3d']

Callers 2

__init__Method · 0.95
__init__Method · 0.95

Calls 1

_sample_from_clipMethod · 0.95

Tested by

no test coverage detected