-
Notifications
You must be signed in to change notification settings - Fork 0
/
X_VGG_arh.py
38 lines (30 loc) · 1.46 KB
/
X_VGG_arh.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
34
35
36
37
38
""" Mreža VGG16"""
vgg16 = VGG16(weights="imagenet", include_top=False,
input_shape=input_shape)
# zamrzovanje nivojev mreže VGG16
for layer in vgg16.layers:
layer.trainable = False
""" Dodani nivoji mreže """
last = UpSampling2D(size=(2, 2))(vgg16.output)
last = Conv2D(256, (3, 3), padding="same", activation="relu",
kernel_regularizer=regularizers.l2(0.01))(last)
last = Conv2D(256, (3, 3), padding="same", activation="relu",
kernel_regularizer=regularizers.l2(0.01))(last)
last = UpSampling2D(size=(2, 2))(last)
last = Conv2D(128, (3, 3), padding="same", activation="relu",
kernel_regularizer=regularizers.l2(0.01))(last)
last = Conv2D(128, (3, 3), padding="same", activation="relu",
kernel_regularizer=regularizers.l2(0.01))(last)
last = UpSampling2D(size=(2, 2))(last)
last = Conv2D(64, (3, 3), padding="same", activation="relu",
kernel_regularizer=regularizers.l2(0.01))(last)
last = Conv2D(64, (3, 3), padding="same", activation="relu",
kernel_regularizer=regularizers.l2(0.01))(last)
last = UpSampling2D(size=(2, 2))(last)
last = Conv2D(32, (3, 3), padding="same", activation="relu",
kernel_regularizer=regularizers.l2(0.01))(last)
last = Conv2D(2, (3, 3), padding="same", activation="relu",
kernel_regularizer=regularizers.l2(0.01))(last)
def resize_image(x):
return K.resize_images(x, 2, 2, "channels_last")
last = Lambda(resize_image)(last)