-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdata.py
29 lines (24 loc) · 816 Bytes
/
data.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from tensorflow.keras.preprocessing.image import ImageDataGenerator
def load_data():
SIZE = 128
batch_size = 64
datagen = ImageDataGenerator(rescale=1./255)
train_generator = datagen.flow_from_directory(
'cell_images2/uninfected_train/',
target_size=(SIZE, SIZE),
batch_size=batch_size,
class_mode='input'
)
validation_generator = datagen.flow_from_directory(
'cell_images2/uninfected_test/',
target_size=(SIZE, SIZE),
batch_size=batch_size,
class_mode='input'
)
anomaly_generator = datagen.flow_from_directory(
'cell_images2/parasitized/',
target_size=(SIZE, SIZE),
batch_size=batch_size,
class_mode='input'
)
return train_generator, validation_generator, anomaly_generator