ave = get_ave_layer_func(len(self._get_shape(3)))
pooling_len = int(model_len / 4)
model = StubModel()
model.input_shape = self.input_shape
model.inputs = [0]
model.layers.append(StubInput())
for i in range(model_len):
model.layers += [StubBatchNormalization(),
StubActivation("relu"),
StubConv(model_width, kernel_size=3, func=conv),
StubDropout(constant.CONV_DROPOUT_RATE)]
if (i + 1) % pooling_len == 0 and i != model_len - 1:
model.layers.append(StubPooling(func=pool))
model.layers.append(StubGlobalPooling(ave))
model.layers.append(StubDense(self.n_classes, activation="softmax"))
model.outputs = [len(model.layers)]
for index, layer in enumerate(model.layers):
layer.input = index
layer.output = index + 1
return Graph(model, False)
class RandomConvClassifierGenerator(ClassifierGenerator):
A classifier generator that generates random convolutional neural networks.