Unverified Commit 5e876e6e authored by Haoyu Zhang's avatar Haoyu Zhang Committed by GitHub
Browse files

Minimize variables and computation in trivial model (#6759)

Previously we had one dense layer in trivial model. The weight was [224*224*3, num_classes].
Using two dense layers, the weights are [224*224*3, 1] and [1, num_classes].
parent cfa37aab
...@@ -31,6 +31,7 @@ def trivial_model(num_classes): ...@@ -31,6 +31,7 @@ def trivial_model(num_classes):
x = layers.Lambda(lambda x: backend.reshape(x, [-1, 224 * 224 * 3]), x = layers.Lambda(lambda x: backend.reshape(x, [-1, 224 * 224 * 3]),
name='reshape')(img_input) name='reshape')(img_input)
x = layers.Dense(1, name='fc1')(x)
x = layers.Dense(num_classes, activation='softmax', name='fc1000')(x) x = layers.Dense(num_classes, activation='softmax', name='fc1000')(x)
return models.Model(img_input, x, name='trivial') return models.Model(img_input, x, name='trivial')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment