Skip to content

Instantly share code, notes, and snippets.

@alexklibisz
Created July 5, 2017 00:59
Show Gist options
  • Save alexklibisz/f05eafe2426aef6a20149f6c1d64ac92 to your computer and use it in GitHub Desktop.
Save alexklibisz/f05eafe2426aef6a20149f6c1d64ac92 to your computer and use it in GitHub Desktop.
17softmax
inputs = Input((200,200,3))
res = resnet50.ResNet50(include_top=False, weights=None, input_tensor=inputs)
# Add a classifier for each class instead of a single classifier.
res_out = Flatten()(res.output)
res_out = Dropout(0.1)(res_out)
classifiers = []
for n in range(17):
classifiers.append(Dense(2, activation='softmax')(res_out))
# Concatenate classifiers and reshape to match output shape.
x = concatenate(classifiers, axis=-1)
labels = x = Reshape((17,1), name='labels')(x)
self.net = Model(inputs=res.input, outputs=labels)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment