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

预训练模型选择 #42

Open
bilibilifaker opened this issue Jun 3, 2024 · 0 comments
Open

预训练模型选择 #42

bilibilifaker opened this issue Jun 3, 2024 · 0 comments

Comments

@bilibilifaker
Copy link

很抱歉再次打扰您,我注意到代码里只对deeplabv2+resnet101的组合提取了预训练权重,对于其他的模型形式则没有,同时您只附上了deeplabv2+resnet101的预训练模型,对于其余的model设置,则未提供同时代码中也未看到需要读取。
是其余模型未开源预训练好的模型吗?还是其他原因而这么设置?如果能有其余模型预训练的model,不会提升最终的miou分数吗?

def init_basic_elems(args):
    model_zoo = {'deeplabv3plus': DeepLabV3Plus, 'pspnet': PSPNet, 'deeplabv2': DeepLabV2}
    model = model_zoo[args.model](args.backbone, 21 if args.dataset == 'pascal' else 19)
    head_lr_multiple = 10.0

    if args.model == 'deeplabv2':
        assert args.backbone == 'resnet101'
        model.load_state_dict(torch.load('pretrained/deeplabv2_resnet101_coco_pretrained.pth'))
        head_lr_multiple = 1.0

    optimizer = SGD([{'params': model.backbone.parameters(), 'lr': args.lr},
                     {'params': [param for name, param in model.named_parameters()
                                 if 'backbone' not in name],
                      'lr': args.lr * head_lr_multiple}],
                    lr=args.lr, momentum=0.9, weight_decay=1e-4)

    model = DataParallel(model).cuda()

    return model, optimizer
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

1 participant