-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
How to get the middle features of the effecientnet for FCN/FPN? #117
Comments
lartpang
changed the title
How to get the middle feature of the effecientnet for FCN/FPN?
How to get the middle features of the effecientnet for FCN/FPN?
Dec 2, 2019
I use the method to do it: class EfficientNet(nn.Module):
...
def extract_features_midconv(self, inputs):
""" Returns output of the middle convolution layers """
out_feats = []
# Stem
x = self._swish(self._bn0(self._conv_stem(inputs)))
prev_x_size = x.size()[-1]
out_feats.append(x)
# Blocks
for idx, block in enumerate(self._blocks):
drop_connect_rate = self._global_params.drop_connect_rate
if drop_connect_rate:
drop_connect_rate *= float(idx) / len(self._blocks)
x = block(x, drop_connect_rate=drop_connect_rate)
if x.size()[-1] != prev_x_size:
prev_x_size = x.size()[-1]
out_feats.append(x)
else:
out_feats[-1] = x
# Head
x = self._swish(self._bn1(self._conv_head(x)))
if x.size()[-1] != prev_x_size:
out_feats.append(x)
else:
out_feats[-1] = x
return out_feats I think this treatment is a little inelegant, do you have a better way? |
What about this solution ?
|
@fmahoudeau Oh..yeah! This is good, and better than my code! 👍 |
#63 also does this |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No description provided.
The text was updated successfully, but these errors were encountered: