Created
October 11, 2019 14:14
-
-
Save evmcheb/4fd2857dc4e3c8b08247eef9a89d3578 to your computer and use it in GitHub Desktop.
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
import os | |
samples = [] | |
labels = [] | |
images_folder = "images/" | |
for image in os.listdir(images_folder): | |
samples.append(img_to_array(load_img(images_folder+image, target_size=(100, 100)))) | |
if "normal" in image: | |
labels.append((0)) | |
else: | |
labels.append((1)) | |
samples = np.array(samples) | |
labels = np.array(labels) | |
eval_x, eval_y = samples[-100:], labels[-100:] | |
print(samples.shape, labels.shape) | |
from sklearn.model_selection import train_test_split | |
x_train, x_test, y_train, y_test = train_test_split(samples[:-100], labels[:-100], test_size=0.2, random_state=31) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment