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

Testing inference with Veri Weights #3

Open
radarjonathan opened this issue Jul 5, 2021 · 2 comments
Open

Testing inference with Veri Weights #3

radarjonathan opened this issue Jul 5, 2021 · 2 comments

Comments

@radarjonathan
Copy link

Hello,
i'm trying to use the model with the weights for Veri I downloaded from your Drive to run simple inference on querys.
When I try to load the weights with load_param I get a key error in line 228 in multiheads_baseline.py ('KeyError: 'groupface.instance_fc.fc.weight')

Can someone help me?

Best regards!

@llf1234
Copy link

llf1234 commented Sep 3, 2021

have you fix this problem?

@sathirafdo
Copy link

sathirafdo commented Nov 1, 2021

The error comes because the keys of the weights of veri does not match the keys in the model created in the code. In the paramdict (loaded from the veri weights), some keys have the 1st part as 'groupface' and in the state_dict ( which contains the weights of the model built in the code) , the same keys have the 1st part 'Multiheads'. (You can verify just by printing the keys)

eg : param_dict : 'groupface.instance_fc.fc.weight'
       corresponding key in state_dict : 'Multiheads.instance_fc.fc.weight'

This seems to be a naming issue only as dimensions of the values match .

So to fix the key error you can add a line of code to make the key names equal. ( In ./track2_aicity_2021/lib/modeling/multiheads_baseline.py > class Baseline > load_param function)

y = i.replace('groupface','MultiHeads')

In the follwing manner :

for i in param_dict:
     y = i.replace('module', 'base')

     y = i.replace('groupface','MultiHeads') <<< add the line in the loop to make the key names equal

     if skip_fc and 'classifier' in i:
         continue

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

3 participants