Created
November 14, 2018 21:05
-
-
Save wotori/af3939c0adb4a0966d4f39f8702cc0fe to your computer and use it in GitHub Desktop.
'.jpg' or '.png' sequence to a list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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