MCPcopy Index your code
hub / github.com/lazyprogrammer/machine_learning_examples / VGG16_AvgPool

Function VGG16_AvgPool

cnn_class2/style_transfer1.py:32–54  ·  view source on GitHub ↗
(shape)

Source from the content-addressed store, hash-verified

30
31
32def VGG16_AvgPool(shape):
33 # we want to account for features across the entire image
34 # so get rid of the maxpool which throws away information
35 vgg = VGG16(input_shape=shape, weights='imagenet', include_top=False)
36
37 # new_model = Sequential()
38 # for layer in vgg.layers:
39 # if layer.__class__ == MaxPooling2D:
40 # # replace it with average pooling
41 # new_model.add(AveragePooling2D())
42 # else:
43 # new_model.add(layer)
44
45 i = vgg.input
46 x = i
47 for layer in vgg.layers:
48 if layer.__class__ == MaxPooling2D:
49 # replace it with average pooling
50 x = AveragePooling2D()(x)
51 else:
52 x = layer(x)
53
54 return Model(i, x)
55
56def VGG16_AvgPool_CutOff(shape, num_convs):
57 # there are 13 convolutions in total

Callers 3

style_transfer2.pyFile · 0.90
style_transfer3.pyFile · 0.90
VGG16_AvgPool_CutOffFunction · 0.85

Calls 1

ModelClass · 0.50

Tested by

no test coverage detected