Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About visual memory M (centroids) update problem #3

Closed
emma-sjwang opened this issue May 16, 2019 · 2 comments
Closed

About visual memory M (centroids) update problem #3

emma-sjwang opened this issue May 16, 2019 · 2 comments
Labels
question Further information is requested

Comments

@emma-sjwang
Copy link

Thanks for the awesome work.

But I do not find the related codes to update the centroids.
In line 45 of file run_networks.py :

if self.memory['init_centroids']:
    self.criterions['FeatureLoss'].centroids.data = self.centroids_cal(self.data['train_plain'])

these codes are utilized for centroids initialization.

In the paper, Section 3.1, Para Learning Visual Memory M, the centroids are updated in two steps.
Could you kindly give me more hints about how to realize the second step, which is the propagation step by alternatively updating the direct feature and the centroids.

Thanks a lot.

@zhmiao
Copy link
Owner

zhmiao commented May 16, 2019

Hello @EmmaW8 , basically after the first stage, where a plain base model is trained, we use the plain model to calculate the class centers. Then in the beginning of the second stage, we use these centers to initialize the self.criterions['FeatureLoss'].centroids.data, and from https://github.com/zhmiao/OpenLongTailRecognition-OLTR/blob/master/run_networks.py#L98 , we initialize an optimizer for the criterion. During training, in the self.batch_backward() function (https://github.com/zhmiao/OpenLongTailRecognition-OLTR/blob/master/run_networks.py#L139), the criterion optimizer is stepped, and this is where the centroids are updated according to the losses, because centroids are updateable parameters of the feature criterion in stage 2. Does this make sense to you?

@zhmiao zhmiao added the question Further information is requested label May 16, 2019
@emma-sjwang
Copy link
Author

@zhmiao Thank you for your detailed responce. :)
It is clear to me now~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants