zhiCHEN96 / ConceptWhitening

MIT License
117 stars 28 forks source link

Train vs. Train baseline #5

Closed pedroalopes closed 3 years ago

pedroalopes commented 3 years ago

Hi! Firstly, thank you for the paper and for publishing the source code.

QUESTION 1 I am having some difficulty in understanding in what situations do the "train" and "train_baseline" functions are used. At first, I thought that the "train" function is used to train the function and apply the CW (Concept Whitening) during training. I also assumed that the "train_baseline" function is used to train a "baseline" model, which could then be trained on CW using the "train" function. However, after investigating the code a bit further, I can see that this does not seem to be true at all. It seems I am misinterpreting the term "baseline".

QUESTION 2 In the "train_places" file, the "train" function contains the following code block:

[BLOCK 1]

(line 267)
 if (i + 1) % 30 == 0:
            model.eval()
            with torch.no_grad():
                # update the gradient matrix G
                for concept_index, concept_loader in enumerate(concept_loaders):
                    model.module.change_mode(concept_index)
                    for j, (X, _) in enumerate(concept_loader):
                        X_var = torch.autograd.Variable(X).cuda()
                        model(X_var)
                        break
                model.module.update_rotation_matrix()
                # change to ordinary mode
                model.module.change_mode(-1)
            model.train()

However, on the "train_isic" file, this same code block (line 237) is commented on the "train" function.

Thank you in advance for your attention and I hope I did not miss anything trivial on the paper.

Best regards, Pedro Lopes