chenyuntc / simple-faster-rcnn-pytorch

A simplified implemention of Faster R-CNN that replicate performance from origin paper
Other
3.97k stars 1.14k forks source link

Train Faster RCNN based VGG16_BN(torchvision) #221

Open chenaifang opened 3 years ago

chenaifang commented 3 years ago

I changed two parts:

The first part is to change VGG16 to VGG16_BN. from model.vgg import vgg16_bn The second part is the changes to decom_vgg16 in faster_rcnn_vgg16.py

def decom_vgg16():
    # the 30th layer of features is relu of conv5_3
    if opt.torch_pretrain:
        model = vgg16_bn(pretrained=False)
        if not opt.load_path:
            model.load_state_dict(t.load(opt.torch_pretrain_path))
    else:
        model = vgg16_bn(not opt.load_path)

    features = list(model.features)[:43]
    classifier = model.classifier

    classifier = list(classifier)
    del classifier[6]
    if not opt.use_drop:
        del classifier[5]
        del classifier[2]
    classifier = nn.Sequential(*classifier)

    # freeze top4 conv
    for layer in features[:14]:
        for p in layer.parameters():
            p.requires_grad = False

    return nn.Sequential(*features), classifier

The training results fasterrcnn_12171601_16_0.5808726427518627

May I ask why the accuracy is low?What can be done to improve the accuracy?

DanZhang123 commented 3 years ago

Hello, have you solved it?