Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use 1x1 convolutions to improve BinaryAlexNet latency on Compute Engine #320

Merged
merged 2 commits into from
May 26, 2021

Conversation

lgeiger
Copy link
Member

@lgeiger lgeiger commented May 26, 2021

This PR updates BinaryAlexNet to use 1x1 convolutions in the classification layer which allows correct conversion to LCE.
This brings the official benchmarks inline with the numbers we quote in the LCE paper. This has a big impact since the classification layers are actually very large.

This code has been lying around on my system for a long time now, so I briefly spent a few minutes converting the weights which was just a matter of reshaping the weights of the last four classification layers.

@lgeiger lgeiger added the feature New feature or request label May 26, 2021
@lgeiger lgeiger requested a review from a team May 26, 2021 14:41
@@ -91,9 +92,9 @@ def build(self) -> tf.keras.models.Model:
if self.include_top:
weights_path = utils.download_pretrained_model(
model="binary_alexnet",
version="v0.2.0",
version="v0.3.0",
file="binary_alexnet_weights.h5",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These weights have been manually reshaped from previous model so that Keras can correctly reload them.

@lgeiger lgeiger merged commit c707f2c into main May 26, 2021
@lgeiger lgeiger deleted the binary-alexnet-classification branch May 26, 2021 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants