- We start by importing all libraries, as follows:
import numpy as npimport cv2import matplotlib.pyplot as pltimport globfrom keras.layers import Input, merge, Conv2D, MaxPooling2D, UpSampling2D, Dropout, Cropping2D, mergefrom keras.optimizers import Adamfrom keras.callbacks import ModelCheckpoint, LearningRateSchedulerfrom keras import backend as Kfrom keras.models import Model
- Then, we need to store all the training filenames:
import osfilenames = []for path, subdirs, files in os.walk('Data/1obj'): for name in files: if 'src_color' in path: filenames.append(os.path.join(path, name)) print('# Training images: {}'.format(len(filenames)))
- Let's plot some example training images and their masks:
n_examples = 3for i in range(n_examples): ...