Giter Club home page Giter Club logo

Comments (8)

CuongNN218 avatar CuongNN218 commented on May 23, 2024

`base = './vfnet_r50_fpn_mdconv_c3-c5_mstrain_2x_coco.py'
model = dict(
pretrained='open-mmlab://res2net101_v1d_26w_4s',
backbone=dict(
type='Res2Net',
depth=101,
scales=4,
base_width=26,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm_cfg=dict(type='BN', requires_grad=True),
norm_eval=True,
style='pytorch',
dcn=dict(type='DCNv2', deform_groups=1, fallback_on_stride=False),
stage_with_dcn=(False, True, True, True)),
neck=dict(
type='PAFPNX',
in_channels=[256, 512, 1024, 2048],
out_channels=384,
start_level=1,
add_extra_convs=True,
extra_convs_on_inputs=False, # use P5
num_outs=5,
relu_before_extra_convs=True,
pafpn_conv_cfg=dict(type='DCNv2'),
no_norm_on_lateral=True,
norm_cfg=dict(type='GN', num_groups=32, requires_grad=True)),
bbox_head=dict(
type='VFNetHead',
num_classes=14,
in_channels=384,
stacked_convs=4,
feat_channels=384,
strides=[8, 16, 32, 64, 128],
regress_ranges=((-1, 64), (64, 128), (128, 256), (256, 512), (512,
1e8)),
anchor_generator=dict(
type='AnchorGenerator',
ratios=[1.0],
octave_base_scale=8,
scales_per_octave=1,
center_offset=0.0,
strides=[8, 16, 32, 64, 128]),
center_sampling=False,
dcn_on_last_conv=True,
use_atss=True,
use_vfl=True,
loss_cls=dict(
type='VarifocalLoss',
use_sigmoid=True,
alpha=0.75,
gamma=2.0,
iou_weighted=True,
loss_weight=1.0),
loss_bbox=dict(type='GIoULoss', loss_weight=1.5),
loss_bbox_refine=dict(type='GIoULoss', loss_weight=2.0)))

training and testing settings

train_cfg = dict(
assigner=dict(type='ATSSAssigner', topk=9),
allowed_border=-1,
pos_weight=-1,
debug=False)
test_cfg = dict(
nms_pre=1000,
min_bbox_size=0,
score_thr=0.05,
nms=dict(type='soft_nms', iou_threshold=0.65),
max_per_img=100)

data setting

dataset_type = 'CocoDataset'
data_root = ''
dataset_type = 'CocoDataset'
classes =('Aortic enlargement',
'Atelectasis',
'Calcification',
'Cardiomegaly',
'Consolidation',
'ILD',
'Infiltration',
'Lung Opacity',
'Nodule/Mass',
'Other lesion',
'Pleural effusion',
'Pleural thickening',
'Pneumothorax',
'Pulmonary fibrosis',)

img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
train_pipeline = [
dict(type='LoadImageFromFile'),
dict(type='LoadAnnotations', with_bbox=True),
dict(
type='RandomCrop',
crop_type='relative_range',
crop_size=(0.75, 0.75),
crop_p=0.5),
dict(
type='Resize',
img_scale=[(896, 896)],
ratio_range=(0.75, 1.25),
multiscale_mode='range',
keep_ratio=True),
dict(
type='CutOut',
n_holes=(5, 10),
cutout_shape=[(4, 4), (4, 8), (8, 4), (8, 8),
(16, 8), (8, 16), (16, 16), (16, 32), (32, 16), (32, 32),
(32, 48), (48, 32), (48, 48)],
cutout_p=0.5),
dict(type='RandomFlip', flip_ratio=0.5),
dict(type='Normalize', **img_norm_cfg),
dict(type='Pad', size_divisor=32),
dict(type='DefaultFormatBundle'),
dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels']),
]
test_pipeline = [
dict(type='LoadImageFromFile'),
dict(
type='MultiScaleFlipAug',
img_scale=[(1200, 1200), (1024, 1024), (896, 896), (640, 640)],
flip=False,
transforms=[
dict(type='Resize', keep_ratio=True),
dict(type='RandomFlip'),
dict(type='Normalize', **img_norm_cfg),
dict(type='Pad', size_divisor=32),
dict(type='DefaultFormatBundle'),
dict(type='Collect', keys=['img']),
])
]
data = dict(
samples_per_gpu=4,
workers_per_gpu=4,
train=dict(
ann_file='/root/vinBigdata/mmdet_data/fold_0/annotations/train.json',
classes=classes,
img_prefix='/root/vinBigdata/mmdet_data/fold_0/train',
pipeline=train_pipeline),
val=dict(ann_file='/root/vinBigdata/mmdet_data/fold_0/annotations/val.json',
classes=classes,
img_prefix='/root/vinBigdata/mmdet_data/fold_0/val',
pipeline=test_pipeline),
test=dict(ann_file='/root/vinBigdata/mmdet_data/fold_0/annotations/val.json',
classes=classes,
img_prefix='/root/vinBigdata/mmdet_data/fold_0/val',
pipeline=test_pipeline))

optimizer

optimizer = dict(
lr=0.005, paramwise_cfg=dict(bias_lr_mult=2., bias_decay_mult=0.))
optimizer_config = dict(grad_clip=None)

learning policy

lr_config = dict(
policy='step',
warmup='linear',
warmup_iters=500,
warmup_ratio=0.1,
step=[36, 40])
total_epochs = 41

swa learning policy

swa_lr_config = dict(
policy='cyclic',
target_ratio=(1, 0.01),
cyclic_times=18,
step_ratio_up=0.0)
swa_total_epochs = 18

runtime

load_from = './weights/SWA-VFNetX-1-18-53.4_VFNetX-R2101-41e-0.01-0.0001-52.2.pth'
resume_from = None
workflow = [('train', 3)]`

from varifocalnet.

CuongNN218 avatar CuongNN218 commented on May 23, 2024

above is my config file

from varifocalnet.

hyz-xmaster avatar hyz-xmaster commented on May 23, 2024

Hi @CuongNN218, what is your MMDetection version? lower than v2.4.0?

from varifocalnet.

CuongNN218 avatar CuongNN218 commented on May 23, 2024

@hyz-xmaster i used mmdetection 2.8.0 and use your repo to training. Can you check my config file for me ?

from varifocalnet.

hyz-xmaster avatar hyz-xmaster commented on May 23, 2024

Hi @CuongNN218, it is normal, because the original Res2Net has no DCN layers, so when you insert DCN layers, there is mismatch between the layer names of the original Res2Net and the DCN-based Res2Net. However, in the pre-trained VFNetX model which you are loading, there are DCN weights in the backbone, matching the DCN-based Res2Net.

from varifocalnet.

hyz-xmaster avatar hyz-xmaster commented on May 23, 2024

Regarding your config file, it seems fine. I am just curious about why you set workflow = [('train', 3)] since it is usual to set workflow = [('train', 1)].

from varifocalnet.

CuongNN218 avatar CuongNN218 commented on May 23, 2024

@hyz-xmaster https://mmdetection.readthedocs.io/en/latest/tutorials/customize_runtime.html#customize-workflow you can read it in the link below. maybe i'm wrong about validation after 3 epochs

from varifocalnet.

hyz-xmaster avatar hyz-xmaster commented on May 23, 2024

@CuongNN218, you can add evaluation = dict(interval=3, metric='bbox') to the config file to enable evaluation on the val set after 3 training epochs. This will overwrite the default evaluation = dict(interval=1, metric='bbox').

from varifocalnet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.