Last active
May 5, 2021 22:08
-
-
Save sxjscience/52e5fc68f0ac1e47d257b4ad24d4b3b8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import os | |
from PIL import Image | |
base_dir = 'image manually' | |
with open('label_file.txt', 'w') as of: | |
for filename in os.listdir(base_dir): | |
print('Labeling filename', filename) | |
img = Image.open(os.path.join(base_dir, filename)) | |
img.show() | |
label = input('Flood = 0, Non-flood=1: ') | |
of.write('{}\t{}\n'.format(filename, label)) | |
img.close() | |
of.flush() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment