Coder Social home page Coder Social logo

Comments (6)

yaoyao-liu avatar yaoyao-liu commented on May 28, 2024

Thanks for your interest in our work.

For Q1: Nothing different. I forget to merge these two lines while cleaning the code.
For Q2: The original version is here. In mnemonics training, this function is just let the image pass the model.
For Q3: Yes.

from class-incremental-learning.

TOM-tym avatar TOM-tym commented on May 28, 2024

Hi, Thanks for your clarification. It helps a lot.

Pardon me for raising another question.
I assume that line 325-373 in mnemonics.py is the 'meta-level' optimazaion, corresponding to formula (7a), (7b), (8), (9), (10a), (10b) in the paper. Is that correct?
However, In my opinion, line 325-373 is just doing things below.

  1. Make example set trainable. line 325-326
  2. Pass through image batch (sample from dataset $D_i$) into the model and get q_feature. line 343-346
  3. Pass through sample image batch to the model and get all_cls_means.
  4. Calculate cross entropy loss.
    In conclusion, turn example set trainable and apply it on the cross entropy loss. I don't find any code corresponding to formula (7b), i.e, train $\theta_i$ on $E_i$.
    Please enlighten me about this.

Also, I can't find any code about “fine-tuning models on only exemplars” as shown in Line 18 in algorithm 1 in the paper.

from class-incremental-learning.

yaoyao-liu avatar yaoyao-liu commented on May 28, 2024

The code for “fine-tuning models on only exemplars” is here:

transform_proto = transforms.Compose([transforms.ToTensor(),transforms.Normalize((0.5071, 0.4866, 0.4409), (0.2009, 0.1984, 0.2023)),])
protoset = torchvision.datasets.CIFAR100(root='./data', train=False, download=False, transform=transform_proto)
X_protoset_array = np.array(X_protoset_cumuls).astype('uint8')
protoset.test_data = X_protoset_array.reshape(-1, X_protoset_array.shape[2], X_protoset_array.shape[3], X_protoset_array.shape[4])
Y_protoset_cumuls = np.array(Y_protoset_cumuls).reshape(-1)
map_Y_protoset_cumuls = map_labels(order_list, Y_protoset_cumuls)
protoset.test_labels = map_Y_protoset_cumuls
protoloader = torch.utils.data.DataLoader(protoset, batch_size=128, shuffle=True, num_workers=2)
fast_fc = torch.from_numpy(np.float32(class_means[:,:,0].T)).to(device)
fast_fc.requires_grad=True
epoch_num = maml_epoch
for epoch_idx in range(epoch_num):
for the_inputs, the_targets in protoloader:
the_inputs, the_targets = the_inputs.to(device), the_targets.to(device)
the_features = tg_feature_model(the_inputs)
the_logits = F.linear(F.normalize(torch.squeeze(the_features), p=2,dim=1), F.normalize(fast_fc, p=2, dim=1))
the_loss = F.cross_entropy(the_logits, the_targets)
the_grad = torch.autograd.grad(the_loss, fast_fc)
fast_fc = fast_fc - maml_lr * the_grad[0]

from class-incremental-learning.

TOM-tym avatar TOM-tym commented on May 28, 2024

Thanks for your early reply.
I am sorry for not reading your code completely. Thanks for pointing out.

What about another question?

I don't find any code corresponding to formula (7b), i.e, train $\theta_i$ on $E_i$.

Sorry to bother you again. Thanks.

from class-incremental-learning.

yaoyao-liu avatar yaoyao-liu commented on May 28, 2024

This part is related to Lines 349-369 in mnemonics.py.
To speed up the training, the inner loop is replaced by a prototype classifier in the current version.

from class-incremental-learning.

TOM-tym avatar TOM-tym commented on May 28, 2024

Thanks for your explanation.
I am closing this issue now.
Best regards.

from class-incremental-learning.

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.