-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrain_start.py
More file actions
95 lines (81 loc) · 1.99 KB
/
Copy pathtrain_start.py
File metadata and controls
95 lines (81 loc) · 1.99 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
from Interpreter import Interpreter
if __name__ == "__main__":
"""
Get raw data and apply CNN model.
"""
TARGET_SIZE = (512, 512)
BATCH_SIZE = 8
EPOCHS = 100
IMAGE_SHAPE_EFFI = (512, 512, 3)
inter = Interpreter(
BATCH_SIZE,
IMAGE_SHAPE_EFFI,
EPOCHS,
TARGET_SIZE
)
train_images, validation_images, test_images = inter.split_data()
# Resnet model:
# https://keras.io/examples/cifar10_resnet/
n = 3
depth = n * 6 + 2
model, model_out = inter.resnet_v1(
input_shape=IMAGE_SHAPE_EFFI,
depth=depth,
train_images=train_images,
test_images=test_images,
validation_images=validation_images
)
# Get score of test data from trained model.
inter.model_evaluation_test(
test_images,
validation_images,
model,
model_out
)
# # Traditional method.
# model, model_out = inter.train_model(
# train_images,
# validation_images,
# 'Nadam',
# 256
# )
# # Get score of test data from trained model.
# inter.model_evaluation_test(
# test_images,
# validation_images,
# model,
# model_out
# )
# # Eff. net
# model, model_out = inter.train_efficient_net(
# train_images,
# test_images,
# validation_images,
# 0
# )
# inter.model_evaluation_test(
# test_images,
# validation_images,
# model,
# model_out
# )
# inter = Interpreter(
# BATCH_SIZE,
# IMAGE_SHAPE_EFFI,
# EPOCHS,
# TARGET_SIZE
# )
# train_images, validation_images, test_images = inter.split_data()
# # Eff. net
# inter.train_efficient_net(
# train_images,
# test_images,
# validation_images,
# 'Nadam'
# )
# Window Optimization.
# inter.windown_optimizer(
# train_images,
# test_images,
# validation_images
# )