-
Notifications
You must be signed in to change notification settings - Fork 178
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
model specifications not coherent with the MLB paper #18
Comments
# in MLBAtt
if self.opt['attention']['glimpse_type'] == 'old':
self.list_linear_v_fusion = nn.ModuleList([
nn.Linear(self.opt['dim_v'],
self.opt['fusion']['dim_h'])
for i in range(self.opt['attention']['nb_glimpses'])])
self.linear_q_fusion = nn.Linear(self.opt['dim_q'],
self.opt['fusion']['dim_h']
* self.opt['attention']['nb_glimpses'])
self.linear_classif = nn.Linear(self.opt['fusion']['dim_h']
* self.opt['attention']['nb_glimpses'],
self.num_classes)
else:
self.linear_v_fusion = nn.Linear(self.opt['dim_v'] * \
self.opt['attention']['nb_glimpses'],
self.opt['fusion']['dim_h'])
self.linear_q_fusion = nn.Linear(self.opt['dim_q'],
self.opt['fusion']['dim_h'])
self.linear_classif = nn.Linear(self.opt['fusion']['dim_h'],
self.num_classes) # in MutanAtt
if self.opt['attention']['glimpse_type'] == 'old':
self.list_linear_v_fusion = nn.ModuleList([
nn.Linear(self.opt['dim_v'],
int(self.opt['fusion']['dim_hv'] /
self.opt['attention']['nb_glimpses']))
for i in range(self.opt['attention']['nb_glimpses'])])
else:
self.linear_v_fusion = nn.Linear(self.opt['dim_v'] * \
self.opt['attention']['nb_glimpses'],
self.opt['fusion']['dim_hv']) # in def _fusion_glimpses(self, list_v_att, x_q_vec):
list_v = []
if self.opt['attention']['glimpse_type'] == 'old':
for glimpse_id, x_v_att in enumerate(list_v_att):
x_v = F.dropout(x_v_att,
p=self.opt['fusion']['dropout_v'],
training=self.training)
x_v = self.list_linear_v_fusion[glimpse_id](x_v)
if 'activation_v' in self.opt['fusion']:
x_v = getattr(F, self.opt['fusion']['activation_v'])(x_v)
list_v.append(x_v)
x_v = torch.cat(list_v, 1)
else:
x_v = torch.cat(list_v_att, 1)
x_v = F.dropout(x_v,
p=self.opt['fusion']['dropout_v'],
training=self.training)
x_v = self.linear_v_fusion(x_v)
if 'activation_v' in self.opt['fusion']:
x_v = getattr(F, self.opt['fusion']['activation_v'])(x_v)
|
Oh I thought you used nn.NLLLoss but I see you use nn.CrossEntropy. Thats fine. |
I will try to do so in the coming month. |
The model configuration is not the same as described in the paper. There is a softmax layer missing at the end of the model. The paper concatenates the attention * vision features for all the glimpses and then pass it through a single linear layer. You use non-linearity both times before and after fusion.
The text was updated successfully, but these errors were encountered: