Giter VIP home page Giter VIP logo

Comments (1)

zilunzhang avatar zilunzhang commented on June 21, 2024

DPGN/main.py

Line 316 in b940111

query_node_pred_loss = [

self.pred_loss(query_node_pred_generation, query_label.long()).mean()

For example, 5 way 1 shot, num_queries=1,
query_node_pred_generation has shape of [batch_size, 5, 5]
query_label has shape of [batch_size, 5]

5 way 1 shot, num_queries=2,
query_node_pred_generation have shape of [batch_size, 10, 5]
query_label has shape of [batch_size, 10]

In query_node_pred_generation, which dimension is the class (i.e., N ways)?

Dear Jing Li,

It is very unfortunate that the codebase is designed only for the setting of num_queries = 1 in the beginning.

We are sorry that the implementation of auxiliary loss (query_node_pred_loss) confuses many readers. Therefore, we decided to propose a modified version that follows most people's intuition. The accuracy for the result of 5-way 1-shot, resnet12, mini-imagenet is still around 67.70±0.52 (almost the same as reported accuracy on the paper, 67.77).

Please replace the content at line 316-319 of main.py by the code below:

        query_node_pred_loss = []
        for query_node_pred_generation in query_node_pred_generations_:
            temp_query_node_pred_generation = query_node_pred_generation.contiguous().view(-1, query_node_pred_generation.shape[-1])
            temp_query_label = query_label.long().contiguous().view(-1, )
            temp_loss = self.pred_loss(temp_query_node_pred_generation, temp_query_label).mean()
            query_node_pred_loss.append(temp_loss)

Also, some configs need to be revised:

config['num_loss_generation'] = 7
train_opt['dec_lr'] = 18000

Let us know if you have any other confusion when using the DPGN.

Yours,
DPGN Team

from dpgn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.