From 1af300988acbe269874b2ded75d87ad77dec0537 Mon Sep 17 00:00:00 2001 From: Si11ium Date: Fri, 2 Aug 2019 18:37:52 +0200 Subject: [PATCH] better regex filtering for smaller memory usage --- dataset/shapenet.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/dataset/shapenet.py b/dataset/shapenet.py index fbf0ed2..be243e0 100644 --- a/dataset/shapenet.py +++ b/dataset/shapenet.py @@ -100,7 +100,15 @@ class CustomShapeNet(InMemoryDataset): paths.extend(glob.glob(os.path.join(pointcloud.path, f'*.{ext}'))) for element in paths: - if all([x not in os.path.split(element)[-1] for x in ['pc.dat', 'pc.xyz']]): + # This was build to filter all variations that aregreater then 25 + pattern = re.compile('^((2[5-9]|[3-5][0-9])_\w+?\d+?|pc|\d+?_pc)\.(xyz|dat)$') + if pattern.match(os.path.split(element)[-1]): + continue + else: + # The following two lines were intendations + # check if it is "just" a pc.dat or pc.xyz + # if all([x not in os.path.split(element)[-1] for x in ['pc.dat', 'pc.xyz']]): + # Assign training data to the data container # Following the original logic; # y should be the label;