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

Question About Attentive Feature Network #5

Open
ccJia opened this issue Nov 16, 2017 · 12 comments
Open

Question About Attentive Feature Network #5

ccJia opened this issue Nov 16, 2017 · 12 comments

Comments

@ccJia
Copy link

ccJia commented Nov 16, 2017

Hi Liu,
I want make sure the construct of AF-Net. Could you help me check it?
I modified the branch behind "ch_concat_3a_chconcat" layer and I just use L = 4.

image

And this is my prototxt for caffe .

layer {
name: "ch_concat_3a_chconcat"
type: "Concat"
bottom: "conv_3a_1x1"
bottom: "conv_3a_3x3"
bottom: "conv_3a_double_3x3_1"
bottom: "conv_3a_proj"
top: "ch_concat_3a_chconcat"
}

layer {
name: "attention_conv_3b_1x1"
type: "Convolution"
bottom: "ch_concat_3a_chconcat"
top: "attention_conv_3b_1x1"
convolution_param {
num_output: 4
kernel_size: 1
stride: 1
pad: 0
}
}

layer {
name: "slice_attention_conv_3b_1x1"
type: "Slice"
bottom: "attention_conv_3b_1x1"
top: "slice_attention_conv_3b_1x1_0"
top: "slice_attention_conv_3b_1x1_1"
top: "slice_attention_conv_3b_1x1_2"
top: "slice_attention_conv_3b_1x1_3"

slice_param {
axis: 1
slice_point: 1
slice_point: 2
slice_point: 3
slice_point: 4
}
}

layer
{
name: "attention_mul_feature_0"
type: "Eltwise"
bottom: "ch_concat_3a_chconcat"
bottom: "slice_attention_conv_3b_1x1_0"
top: "attention_mul_feature_0"
eltwise_param {
operation: PROD
}
}
layer
{
name: "attention_mul_feature_1"
type: "Eltwise"
bottom: "ch_concat_3a_chconcat"
bottom: "slice_attention_conv_3b_1x1_1"
top: "attention_mul_feature_1"
eltwise_param {
operation: PROD
}
}
layer
{
name: "attention_mul_feature_2"
type: "Eltwise"
bottom: "ch_concat_3a_chconcat"
bottom: "slice_attention_conv_3b_1x1_2"
top: "attention_mul_feature_2"
eltwise_param {
operation: PROD
}
}
layer
{
name: "attention_mul_feature_3"
type: "Eltwise"
bottom: "ch_concat_3a_chconcat"
bottom: "slice_attention_conv_3b_1x1_3"
top: "attention_mul_feature_3"
eltwise_param {
operation: PROD
}
}
layer {
name: "attention_3a_chconcat"
type: "Concat"
bottom: "attention_mul_feature_0"
bottom: "attention_mul_feature_1"
bottom: "attention_mul_feature_2"
bottom: "attention_mul_feature_3"
top: "attention_3a_chconcat"
}
Thank you.

@xh-liu
Copy link
Owner

xh-liu commented Nov 16, 2017

Hi,
Your basic structure is correct, however there are some parts which is different from my implementation:

  1. The layers from attention_mul_feature_0 to attention_mul_feature_3 should be element wise multiplication of ch_concat_3a_chconcat and slice_attention_conv_3b_1x1_tile, where slice_attention_conv_3b_1x1_tile is tiled to be have the same number of channels as ch_concat_3a_chconcat. Otherwise the dimension between ch_concat_3a_chconcat and slice_attention_conv_3b_1x1 mismatches, and there will be error in element wise production.
  2. I did not concat attention_mul_feature_0 to attention_mul_feature_3 to get attention_3a_chconcat and pass through the following blocks, but just let concat attention_mul_feature_0 to concat attention_mul_feature_3 pass through the following blocks respectively.
    Hope this will help you!
    Best,
    Xihui

@ccJia
Copy link
Author

ccJia commented Nov 16, 2017

Hi,

image

According to the snapshot above, the input "F" is [C,H,W] and the output attention map "a" is [L,H,W]. In this case , L, as your suggestions is 8.
My question is how to do the element-wise multiplication between "F" and "a"?
If I understand , I will get one slice of "a" and do the element-wise multiplication for each channel of "F". Or “a” is indeed [L*C,H,W], we could get L copies of attention maps and each with [C,H,W], then we can perform element-wise multiplication.

@ccJia
Copy link
Author

ccJia commented Nov 20, 2017

@xh-liu Could you help us ? T-T

@Li1991
Copy link

Li1991 commented Dec 26, 2017

Hi, have you re-implemented this paper? Can you give a prototxt example? Thank you very much! @ccJia

@ccJia
Copy link
Author

ccJia commented Dec 27, 2017

@Li1991 I haven't finished it . The AF Net is confusing me.....And I don't know how to implement it.

@bilipa
Copy link

bilipa commented Jan 2, 2018

@ccJia
It may said: for each channel for attention map, use it to multiplicate with F.
It can see from Fig 4

@xh-liu
Copy link
Owner

xh-liu commented Jan 3, 2018

@ccJia Yes, your understanding is right. We get one slice of "a" and do the element-wise multiplication for each channel of "F".

@ccJia
Copy link
Author

ccJia commented Jan 4, 2018

@xh-liu Thank you ^-^ !

@hezhenjun123
Copy link

@xh-liu Hi,it seems that the @ccJia prototxt has some error else,i think the number of each output about the "a" element-wise multiplicate with the "F" is 24(38),and the total number output to the GAP is 72(243).Which means each of the "a" need element-wise multiplicate with the "F1,F2 and F3",is that right?

@hezhenjun123
Copy link

@xh-liu 24(3x8) and 72(24x3),sorry for the typewriting...

@bilipa
Copy link

bilipa commented Feb 27, 2018

@hezhenjun123 I think the GAP input is (24x3 + 1) which mean (hydra, plus)

@hezhenjun123
Copy link

@bilipa yeah, i think you are right!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants