Skip to content

Instantly share code, notes, and snippets.

@wotori
Created November 14, 2018 21:05
Show Gist options
  • Save wotori/af3939c0adb4a0966d4f39f8702cc0fe to your computer and use it in GitHub Desktop.
Save wotori/af3939c0adb4a0966d4f39f8702cc0fe to your computer and use it in GitHub Desktop.
'.jpg' or '.png' sequence to a list
def seqToArray(path):
data = []
for i in range(1491):
if os.listdir(path)[0][-3:] == 'jpg':
data.append(array(Image.open(path + '{}'.format(i+1) + '.jpg')))
elif os.listdir(path)[0][-3:] == 'png':
data.append(array(Image.open(path + '{}'.format(i+1) + '.png')))
else :
print('there is no "jpg" jr "png" inside')
return data
#images to list
x = seqToArray('hack_online_data/train/')
#mask to list
y = seqToArray('hack_online_data/train_mask/')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment