You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I am trying to retrain the linear classifier by changing the number of classes. This is what I did.
First I trained the features using the following command
This part executes properly. Now I would like to evaluate the trained algorithm. The trained model from this step is saved as ./checkpoint.pth.tar. So, I execute the above command with the --evaluate flag turned on
The model throws an error as it is expecting 1000 classes and not 5.
size mismatch for module.linear.weight: copying a param with shape torch.Size([1000, 1536]) from checkpoint, the shape in current model is torch.Size([5, 1536]).
size mismatch for module.linear.bias: copying a param with shape torch.Size([1000]) from checkpoint, the shape in current model is torch.Size([5]).
print(f"Accuracy of the network on the {len(dataset_val)} test images: {test_stats['acc1']:.1f}%")
return
It is downloading new weights and trying to run the evaluation on the new weights.
I think this is a bug and if I am providing the weights, it should not download the weights as it is doing in the utils.load_pretrained_linear_weights.
When I comment out Line 80 in the eval_linear.py file, the code works fine.
Is this the right thing to do. Please let me know.
P.S.: I know that positing screenshots is generally not the norm. But I wanted to show that it is downloading new weights.
The text was updated successfully, but these errors were encountered:
Hi,
I am trying to retrain the linear classifier by changing the number of classes. This is what I did.
First I trained the features using the following command
Now that I have trained my features. I will run a linear classifier as follows
This part executes properly. Now I would like to evaluate the trained algorithm. The trained model from this step is saved as
./checkpoint.pth.tar
. So, I execute the above command with the--evaluate
flag turned onHowever, in this case I get the following error:
The model throws an error as it is expecting 1000 classes and not 5.
When I look at the code
dino/eval_linear.py
Lines 79 to 83 in 7c446df
It is downloading new weights and trying to run the evaluation on the new weights.
I think this is a bug and if I am providing the weights, it should not download the weights as it is doing in the
utils.load_pretrained_linear_weights
.When I comment out Line 80 in the
eval_linear.py
file, the code works fine.Is this the right thing to do. Please let me know.
P.S.: I know that positing screenshots is generally not the norm. But I wanted to show that it is downloading new weights.
The text was updated successfully, but these errors were encountered: