#set m, n for resized image size
m = 256
n = 256
data = []
expandedPosClass = resizeAndExpandDataset(posImageList, m, n)
expandedNegClass = resizeAndExpandDataset(negImageList, m, n)
for im in expandedPosClass:
data.append([np.array(im), 1])
for im in expandedNegClass:
data.append([np.array(im), 0])
#randomly shuffle the data
np.random.shuffle(data)
#split the data into training and testing data
train_data, test_data = train_test_split(data, test_size=0.3)
# split the data into features and labels
train_x = np.array([i[0] for i in train_data])
# train_x = tf.expand_dims(train_x, axis=-1)
train_y = np.array([i[1] for i in train_data])
test_x = np.array([i[0] for i in test_data])
test_y = np.array([i[1] for i in test_data])
view raw datasetup.py hosted with ❤ by GitHub