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

Task importance analysis #37

Open
ZhugeKongan opened this issue Mar 9, 2022 · 5 comments
Open

Task importance analysis #37

ZhugeKongan opened this issue Mar 9, 2022 · 5 comments

Comments

@ZhugeKongan
Copy link

`def task_importance_weights(label_array):
uniq = torch.unique(label_array)
num_examples = label_array.size(0)

m = torch.zeros(uniq.shape[0])

for i, t in enumerate(torch.arange(torch.min(uniq), torch.max(uniq))):
    m_k = torch.max(torch.tensor([label_array[label_array > t].size(0), 
                                  num_examples - label_array[label_array > t].size(0)]))
    m[i] = torch.sqrt(m_k.float())

imp = m/torch.max(m)
return imp`

IF this code are diffrent from origin paper"Ordinal Regression with Multiple Output CNN for Age Estimation"
image

@ZhugeKongan
Copy link
Author

why not ?

imps=[]
label = np.array([dataset[i][1] for i in range(len(dataset))])
# print(label.shape)
for i in range(max(label)+1):
    imp=len(label[np.where(label==i)])
    imp=np.sqrt(imp*1.0)
    imps.append(imp)
imps = imps/np.sum(imps)
return torch.from_numpy(np.array(imps))

@rasbt
Copy link
Member

rasbt commented Mar 9, 2022

Thanks for the comment. Just to make sure we are on the same page, your question is why we used a different task importance weight than Niu et al? We tried the method in Niu et al., and in our case it made the performance worse for both CORAL and the Niu et al. ordinal CNN. So, we tried different methods for task importance and found that the one we included worked best.

@ZhugeKongan
Copy link
Author

Thanks Reply. I still have some questions, the ordinal CNN usually refers to which paper?
I have the same problem using Niu et al. task importance. Can i find the origin paper of your code " task_importance_weights(label_array) " ?

Thanks again for your reply!

@rasbt
Copy link
Member

rasbt commented Mar 9, 2022

Ordinal CNN is the method by Niu et al. 2016 you mentioned at the top of this thread ("Ordinal Regression with Multiple Output CNN for Age Estimation").

Sure. We have a task importance discussion in an earlier arxiv version of the paper but decided to remove it from the final paper because it was not super essential. You can find it here: https://arxiv.org/pdf/1901.07884v4.pdf

Screen Shot 2022-03-09 at 9 15 49 AM

Screen Shot 2022-03-09 at 9 15 57 AM

@ZhugeKongan
Copy link
Author

Thanks for reply !

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

No branches or pull requests

2 participants