vgsatorras / few-shot-gnn

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

About the last layer of GNN

kikyou123 opened this issue · comments

commented

Thanks for sharing the code, I have a question about the last layer of GNN.
As the code, the output dim of the last layer of GNN is the number of training category C (such as C-way-K-shot). I think the last layer of GNN is equivalent to the classification layer (such as the last fc layer of a classification network). However, this layer is fixed when testing. Shouldn't there be different classification layer for different tasks? I am very confused why you fixed the last layer of GNN in your network.

The last layer outputs the predicted label with respect to the inputted labels of the support set. Let me explain it with an example:

We have a support set of 3 images, each one from a different class (3-Way 1-shot), with the following labels:
x1, y1 = [1, 0, 0]
x2, y2 = [0, 1, 0]
x3, y3 = [0, 0, 1]
Now we predict the label for an image "x" which is from the same class than x2, hence we predict the label [0, 1, 0].

If we run another episode with the same images but swapping the format of the labels:
x1, y1 = [0, 1, 0]
x2, y2 = [1, 0, 0]
x3, y3 = [0, 0, 1]
Now the predicted label for the image "x" will be [1, 0, 0], because it is predicted with respect to the labels of the support set.

Does that answer your question?

commented

Thanks, I got it.