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

Unable to reproduce numbers on ImagenetLT from the given GPaco Resnet50 checkpoint #21

Open
pradipto111 opened this issue Mar 1, 2023 · 2 comments

Comments

@pradipto111
Copy link

We used the code below to load gpaco_r50_imagenetlt.pth.tar onto model and evaluated it on ImagenetLT. We ensured to use the correct moco builder files and appropriate parameters given in this repo. However, the model gives near 0 accuracy on ImagenetLT.

We were able to load the parameters successfully from the checkpoint to the model. We are unable to pinpoint the reason for the reduced accuracy, and seek your help for the same.

        if 'paco' in args.path:

            model = moco.builder.MoCo(
                models.__dict__[args.model],
                args.moco_dim, args.moco_k, args.moco_m, args.moco_t, args.mlp, args.feat_dim, num_classes=1000)
        else:
            model = models.__dict__[args.model](num_classes=args.nb_classes, use_norm=args.use_norm)


        if args.path.startswith('https'):
            checkpoint = torch.hub.load_state_dict_from_url(
                args.path, map_location='cpu', check_hash=True)
        else:
            print("[INFORMATION] Loading teacher model from path ", args.path)
            checkpoint = torch.load(args.path, map_location='cuda:0')


        if 'paco' in args.path:
            
            model.to(device)
            model = torch.nn.parallel.DistributedDataParallel(model, device_ids = [0], find_unused_parameters = True)
            model.load_state_dict(checkpoint['state_dict'])
        else:
            model.load_state_dict(checkpoint['model'] if 'model' in checkpoint.keys() else checkpoint['state_dict'])
        
        model.to(device)
        model.eval()
@jiequancui
Copy link
Collaborator

Hi,

Thanks for your interest in our work.
Have you tried our evaluation script (GPaCo/LT/sh/LT)/ImageNetLT_eval_R50.sh)?

Best,

@jiequancui
Copy link
Collaborator

Hi,

I have loaded the checkpoint "gpaco_r50_imagenetlt.pth.tar" and evaluated it on ImageNet-LT with our provided evaluation script. It works well and achieves 58.548 top-1 accuracy.

Is it possible that your downloaded checkpoint is corrupted during network transfer?

I'm very glad to discuss questions about our work if needed further.

Best,
Jiequan

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