Skip to content

Instantly share code, notes, and snippets.

@codingPingjun
Created March 2, 2017 08:05
Show Gist options
  • Save codingPingjun/aabe39e7c8423246bc8bb88e79f7db27 to your computer and use it in GitHub Desktop.
Save codingPingjun/aabe39e7c8423246bc8bb88e79f7db27 to your computer and use it in GitHub Desktop.
Providing Data for Segmentation
def generate_arrays_from_file(path):
while 1:
f = open(path)
for line in f:
# create numpy arrays of input data
# and labels, from each line in the file
x, y = process_line(line)
img = load_images(x)
yield (img, y)
f.close()
model.fit_generator(generate_arrays_from_file('/my_file.txt'),
samples_per_epoch=10000, nb_epoch=10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment