From bd643d4710f39d72ef6ce19a1e4785d2a7176888 Mon Sep 17 00:00:00 2001 From: HsuanKung Yang Date: Sat, 26 Sep 2020 12:36:02 +0800 Subject: [PATCH 1/3] 20200926, fix sintel reader 'os.listdir' will return different results in different filesystems, add 'sorted()' to make sure the order. --- reader/sintel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reader/sintel.py b/reader/sintel.py index 37e67c8..e7abeb7 100644 --- a/reader/sintel.py +++ b/reader/sintel.py @@ -26,7 +26,7 @@ def list_data(path = None): c = 0 dataset[part + str(1)][subset] = [] dataset[part + str(2)][subset] = [] - for seq in os.listdir(os.path.join(path, part, subset)): + for seq in sorted(os.listdir(os.path.join(path, part, subset))): frames = os.listdir(os.path.join(path, part, subset, seq)) frames = list(sorted(map(lambda s: int(pattern.match(s).group(1)), filter(lambda s: pattern.match(s), frames)))) From c3f6099012da421f6a286b4215d3a214c14969f8 Mon Sep 17 00:00:00 2001 From: HsuanKung Yang Date: Sun, 27 Sep 2020 11:31:25 +0800 Subject: [PATCH 2/3] 20200927, fix Kitti reader This line causes the queue blocked when training on the sintel+kitti2015+hd1k setting. --- reader/kitti.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reader/kitti.py b/reader/kitti.py index 417b7e4..2ce76f8 100644 --- a/reader/kitti.py +++ b/reader/kitti.py @@ -41,7 +41,7 @@ def read_dataset(path = None, editions = 'mixed', parts = 'mixed', crop = None, num_files = len(os.listdir(path_flows)) - 1 ind_valids = VALIDATE_INDICES[edition] num_valids = len(ind_valids) - if samples is not None: + if samples is not -1: num_files = min(num_files, samples) ind = 0 for k in range(num_files): @@ -96,7 +96,7 @@ def read_dataset_testing(path = None, editions = 'mixed', resize = None, samples for edition in editions: path_testing = path[edition + 'testing'] num_files = (len(os.listdir(path_testing)) - 1) // 2 - if samples is not None: + if samples is not -1: num_files = min(num_files, samples) for k in range(num_files): img0 = cv2.imread(os.path.join(path_testing, '%06d_10.png' % k)) From 2353b5ca11dae9f3711358ad5cb19ca622f3df53 Mon Sep 17 00:00:00 2001 From: HsuanKung Yang Date: Sun, 27 Sep 2020 11:32:21 +0800 Subject: [PATCH 3/3] 20200927, fix hd1k reader The same order issue caused by `os.listdir` --- reader/hd1k.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reader/hd1k.py b/reader/hd1k.py index 69f1333..d0a56be 100644 --- a/reader/hd1k.py +++ b/reader/hd1k.py @@ -23,7 +23,7 @@ def read_dataset(path = None, parts = 'mixed', resize = None, samples = -1, norm dataset['occ'] = [] path_images = path['image'] path_flows = path['flow_occ'] - list_files = os.listdir(path_flows) + list_files = sorted(os.listdir(path_flows)) num_files = len(list_files) - 1 ind_valids = VALIDATE_INDICES num_valids = len(ind_valids)