-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathTrain.py
33 lines (26 loc) · 914 Bytes
/
Train.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
30
31
32
33
import tensorflow as tf
from Model import Model
from Data_Loader import Data_Loader
# Instantiate the model
model = Model()
# ======================# Prepare Data #======================
Data_LoaderObj = Data_Loader(augmentation=False)
directory = "data/images/Train"
if not Data_LoaderObj.augmentation:
imgs, labels = Data_LoaderObj.load_images_from_directory(directory=directory)
# preproccess data
x_train, y_train_label, y_train_mask = Data_LoaderObj.prepare_data(
img=imgs, all_label=labels
)
else:
# TODO: Implement data proccesing with augmented data
pass
# ======================# End #======================
# ======================# Train model #======================
model.fit(
x_train=x_train,
y_train_label=y_train_label,
y_train_mask=y_train_mask,
epochs=5,
batch_size=2, # you can change this based on Computation power available for you
)