Skip to content

Commit 2055574

Browse files
authored
fix load_images (#67)
1 parent 7dabe49 commit 2055574

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

tensorlayerx/vision/transforms/utils.py

+10-4
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,16 @@ def load_images(path, n_threads = 10):
9292
'''
9393
images = []
9494
files = sorted(os.listdir(path))
95-
for file in range(0, len(files), n_threads):
96-
image_list = files[file:file + n_threads]
97-
image = threading_data(image_list, fn=load_image, path = path)
98-
images.extend(image)
95+
if n_threads == 0:
96+
for file in files:
97+
file = os.path.join(path, file)
98+
image = load_image(file)
99+
images.append(image)
100+
else:
101+
for file in range(0, len(files), n_threads):
102+
image_list = files[file:file + n_threads]
103+
image = threading_data(image_list, fn=load_image, path = path)
104+
images.extend(image)
99105
return images
100106

101107

0 commit comments

Comments
 (0)