Skip to content

Commit

Permalink
minor update to LegacyNorm
Browse files Browse the repository at this point in the history
  • Loading branch information
TimoStoff committed Jul 3, 2020
1 parent 8e95c03 commit b2796b2
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions data_loader/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ def find_ts_index(self, timestamp):

def __init__(self, data_path, transforms={}, sensor_resolution=None, num_bins=5,
voxel_method=None, max_length=None, combined_voxel_channels=True):
"""
self.transform applies to event voxels, frames and flow.
self.vox_transform applies to event voxels only.
"""

self.num_bins = num_bins
self.data_path = data_path
Expand All @@ -129,18 +133,16 @@ def __init__(self, data_path, transforms={}, sensor_resolution=None, num_bins=5,
self.set_voxel_method(voxel_method)

if 'LegacyNorm' in transforms.keys() and 'RobustNorm' in transforms.keys():
raise Exception
raise Exception('Cannot specify both LegacyNorm and RobustNorm')

self.normalize_voxels = False
if 'RobustNorm' in transforms.keys():
vox_transforms_list = [eval(t)(**kwargs) for t, kwargs in transforms.items()]
del (transforms['RobustNorm'])
self.normalize_voxels = True
self.vox_transform = Compose(vox_transforms_list)
if 'LegacyNorm' in transforms.keys():
vox_transforms_list = [eval(t)(**kwargs) for t, kwargs in transforms.items()]
del (transforms['LegacyNorm'])
self.vox_transform = Compose(vox_transforms_list)
for norm in ['RobustNorm', 'LegacyNorm']:
if norm in transforms.keys():
vox_transforms_list = [eval(t)(**kwargs) for t, kwargs in transforms.items()]
del (transforms[norm])
self.normalize_voxels = True
self.vox_transform = Compose(vox_transforms_list)
break

transforms_list = [eval(t)(**kwargs) for t, kwargs in transforms.items()]

Expand Down

0 comments on commit b2796b2

Please sign in to comment.