-
Notifications
You must be signed in to change notification settings - Fork 9
/
tests.py
79 lines (53 loc) · 2.25 KB
/
tests.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
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
from blurpool import *
import unittest
from keras.layers import *
from keras.models import Model
class TestBlurPool(unittest.TestCase):
def test_avg_1d(self):
layer_input = Input((224, 3))
layer_pool = AverageBlurPooling1D()(layer_input)
layer_flatten = Flatten()(layer_pool)
layer_dense = Dense(1)(layer_flatten)
model = Model(inputs=layer_input, outputs=layer_dense)
model.summary()
model.predict([np.random.random((1, 224, 3))])
def test_max_1d(self):
layer_input = Input((224, 3))
layer_pool = MaxBlurPooling1D()(layer_input)
layer_flatten = Flatten()(layer_pool)
layer_dense = Dense(1)(layer_flatten)
model = Model(inputs=layer_input, outputs=layer_dense)
model.summary()
model.predict([np.random.random((1, 224, 3))])
def test_blur_1d(self):
layer_input = Input((224, 3))
layer_pool = BlurPool1D()(layer_input)
layer_flatten = Flatten()(layer_pool)
layer_dense = Dense(1)(layer_flatten)
model = Model(inputs=layer_input, outputs=layer_dense)
model.summary()
model.predict([np.random.random((1, 224, 3))])
def test_avg_2d(self):
layer_input = Input((224, 224, 3))
layer_pool = AverageBlurPooling2D()(layer_input)
layer_flatten = Flatten()(layer_pool)
layer_dense = Dense(1)(layer_flatten)
model = Model(inputs=layer_input, outputs=layer_dense)
model.summary()
model.predict([np.random.random((1, 224, 224, 3))])
def test_max_2d(self):
layer_input = Input((224, 224, 3))
layer_pool = MaxBlurPooling2D()(layer_input)
layer_flatten = Flatten()(layer_pool)
layer_dense = Dense(1)(layer_flatten)
model = Model(inputs=layer_input, outputs=layer_dense)
model.summary()
model.predict([np.random.random((1, 224, 224, 3))])
def test_blur_2d(self):
layer_input = Input((224, 224, 3))
layer_pool = BlurPool2D()(layer_input)
layer_flatten = Flatten()(layer_pool)
layer_dense = Dense(1)(layer_flatten)
model = Model(inputs=layer_input, outputs=layer_dense)
model.summary()
model.predict([np.random.random((1, 224, 224, 3))])