yolact icon indicating copy to clipboard operation
yolact copied to clipboard

Change Resnet backbone to Res2Net

Open udkii opened this issue 2 years ago • 0 comments

Hello. I need some help.

I'm trying to change my backbone Resnet to Res2Net. I added 'class Res2Net' in backbone.py. ( I just copied Res2Net.py and pasted in backbone file)

https://github.com/Res2Net/Res2Net-PretrainedModels/blob/master/res2net.py This is the code that I pasted at backbone.py.

And I made 'res2net50_backbone' in config file, at the 'BACKBONES' part.

But I don't think I made right way. Because I justed wrote 'name; and 'args'. I have no idea how to change the code.

I want to train a model(use Res2Net backbone) from scratch, not use pretrained model.

Can anyone help me please?

I attached my part of config file that I changed.

----------------------- config.py -----------------------

from backbone import Res2Net

----------------------- BACKBONES -----------------------

backbone_base = Config({ 'name': 'Base Backbone', 'path': 'path/to/pretrained/weights', 'type': object, 'args': tuple(), 'transform': resnet_transform,

'selected_layers': list(),
'pred_scales': list(),
'pred_aspect_ratios': list(),

'use_pixel_scales': False,
'preapply_sqrt': True,
'use_square_anchors': False,

})

res2net50_backbone = backbone_base.copy({ 'name' : 'Res2Net50', 'args': ([3, 4, 6, 3],)

})

----------------------- YOLACT v1.0 CONFIGS -----------------------

yolact_res2net_config = yolact_base_config.copy({ 'name': 'yolact_res2net',

# Dataset stuff
'dataset': scaffold_dataset,
'num_classes': len(scaffold_dataset.class_names) + 1,

'max_size' : 550,
'max_iter': 7000,
'lr_steps': (60000, 100000),

'backbone' : res2net50_backbone.copy({
    'pred_aspect_ratios': [ [[0.1, 1/2, 1, 2, 10]] ]*5,

    'pred_scales': [[32], [64], [128], [256], [512]],
    'use_square_anchors': False,
})

})

udkii avatar Jan 26 '22 08:01 udkii