-
Notifications
You must be signed in to change notification settings - Fork 6
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
Code doesn't work correctly and results don't replicate #2
Comments
@viggykrish Thanks for your question. There is indeed a bug in line 226, thanks for noticing. However, this part of the code is reached only when Can you make sure that you used the settings as used in |
Thank you for getting back so quickly. I also updated another line in evaluate.py to model.load_state_dict(state_dict,strict=False) Otherwise I get the following runtime error. Exception has occurred: RuntimeError |
I ran evaluate.py with the flags shown in the README (in serial mode). Unfortunately, the results didn't improve and in fact look like garbage. I think setting strict=False is not helping with the results eventhough the code ran. evaluate.py --model_name loca_few_shot --backbone resnet50 --swav_backbone --reduction 8 --image_size 512 --num_enc_layers 3 --num_ope_iterative_steps 3 --emb_dim 256 --num_heads 8 --kernel_dim 3 --num_objects 3 --pre_norm |
I am able to reproduce the results in the paper using the evaluate script. I was able to get past the errors in my previous comment by modifying the checkpoint load as follows model = build_model(args) state_dict = torch.load(os.path.join(args.model_path, f'{args.model_name}.pt'))['model'] evaluate.py --model_name loca_few_shot --backbone resnet50 --swav_backbone --reduction 8 --image_size 512 --num_enc_layers 3 --num_ope_iterative_steps 3 --emb_dim 256 --num_heads 8 --kernel_dim 3 --num_objects 3 --pre_norm Val set MAE: 10.22 RMSE: 32.52 |
@viggykrish I see that the issue for you is a mismatch between state dicts. Can you tell me which version of PyTorch you use? |
I could confirm that the code and weights provided by the authors could achieve the same results in their paper. |
These are the results I got for FSC-147 - From running the evaluation code with the provided checkpoints: From training the model using the provided training code: Most results (except test RMSE) look reasonable compared to the published ones. The test RMSE from running the training code is quite high but still SOTA for class-agnostic counting. |
Thank you @niki-amini-naieni for rerunning the experiments and confirming that the results reproduce. Regarding the higher RMSE, I noticed that all 4 metrics have a bit of variance across runs. I observed this for all competing methods, too. I would say that this is caused by the not-so-nice distribution of object counts in FSC147. Nonetheless, I performed several runs and the results were consistently SOTA (with some runs obviously better than others). |
The code errors out in ope.py on line 226
key=self.with_emb(appearance)
I fixed this to the following
key=self.with_emb(appearance, query_pos_emb)
The code now runs but the results are not very good. Can you take a look?
The text was updated successfully, but these errors were encountered: