Yuanbo2020 / ERGL

8 stars 1 forks source link

About the code #1

Open plokm2556 opened 1 day ago

plokm2556 commented 1 day ago

Hello, I'm reading your paper. In your paper, you write "we employ n independent FC layers with 64 units to learn n embeddings separately, where each embedding describes a unique pre-defined audio event." ,I want to know how these "independent FC layers" are programmed, can you please share this part? Thank you very much for your help.

Yuanbo2020 commented 1 day ago

Hi there, the structure of the "independent FC layers" is as follows:

1111111111111111

For more details, please refer to Fig. 1 in the paper (https://ieeexplore.ieee.org/abstract/document/10264066).

The corresponding code is like below.

    def __init__(self, event_num, emb_dim=64):
        ......
        self.event_emb_layers = nn.ModuleList([nn.Linear(2048, emb_dim, bias=True) for _ in range(event_num)])
        self.fc_classification_layers = nn.ModuleList([nn.Linear(emb_dim, 1, bias=True) for _ in range(event_num)])
        ......
    def forward(self, input):
        ......
        event_embs = [F.relu_(each_layer(x)) for each_layer in self.event_emb_layers]
        linear_events = [each_layer(event_embs[num]) for num, each_layer in enumerate(self.fc_classification_layers)]
        ......

Hope it is helpful for you.

plokm2556 commented 1 day ago

Thank you for your generosity, this is very meaningful for my research.

凌白衣 @.***

 

------------------ 原始邮件 ------------------ 发件人: "Yuanbo2020/ERGL" @.>; 发送时间: 2024年9月18日(星期三) 晚上6:09 @.>; @.**@.>; 主题: Re: [Yuanbo2020/ERGL] About the code (Issue #1)

Hi there, the structure of the "independent FC layers" is as follows: 1111111111111111.PNG (view on web)

For more details, please refer to Fig. 1 in the paper (https://ieeexplore.ieee.org/abstract/document/10264066).

The corresponding code is like below. def init(self, event_num, emb_dim=64): ...... self.event_emb_layers = nn.ModuleList([nn.Linear(2048, embdim, bias=True) for in range(event_num)]) self.fc_classification_layers = nn.ModuleList([nn.Linear(embdim, 1, bias=True) for in range(event_num)]) ...... def forward(self, input): ...... eventembs = [F.relu(each_layer(x)) for each_layer in self.event_emb_layers] linear_events = [each_layer(event_embs[num]) for num, each_layer in enumerate(self.fc_classification_layers)] ......

Hope it is helpful for you.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>