Skip to content
This repository has been archived by the owner on Mar 4, 2023. It is now read-only.

Run fcos with the tiny person dataset #2

Closed
Hshuqin opened this issue Jul 4, 2021 · 3 comments
Closed

Run fcos with the tiny person dataset #2

Hshuqin opened this issue Jul 4, 2021 · 3 comments

Comments

@Hshuqin
Copy link

Hshuqin commented Jul 4, 2021

hello,I modified the fcos profile based on three existing profiles (retinanet, faster rcnn, reppoints), but the final result is very low performance( Or, is that how it performs ? ), I don't know where the problem exists, can you give me some advice?

My configuration file is as follows.

`_base_ = [
    '../../_base_/datasets/TinyPerson/TinyPerson_detection_640x512.py',
    '../../../configs/_base_/schedules/schedule_1x.py', '../../../configs/_base_/default_runtime.py'
]
optimizer = dict(type='SGD', lr=0.005, momentum=0.9, weight_decay=0.0001)  # single GPU
model = dict(
    type='FCOS',
    pretrained='open-mmlab://detectron/resnet50_caffe',
    backbone=dict(
        type='ResNet',
        depth=50,
        num_stages=4,
        out_indices=(0, 1, 2, 3),
        frozen_stages=1,
        norm_cfg=dict(type='BN', requires_grad=False),
        norm_eval=True,
        style='caffe'),
    neck=dict(
        type='FPN',
        in_channels=[256, 512, 1024, 2048],
        out_channels=256,
        start_level=1,
        add_extra_convs=True,
        extra_convs_on_inputs=False,  # use P5
        num_outs=5,
        relu_before_extra_convs=True),
    bbox_head=dict(
        type='FCOSHead',
        num_classes=1, # 80
        in_channels=256,
        stacked_convs=4,
        feat_channels=256,
        strides=[8, 16, 32, 64, 128],
        loss_cls=dict(
            type='FocalLoss',
            use_sigmoid=True,
            gamma=2.0,
            alpha=0.25,
            loss_weight=1.0),
        loss_bbox=dict(type='IoULoss', loss_weight=1.0),
        loss_centerness=dict(
            type='CrossEntropyLoss', use_sigmoid=True, loss_weight=1.0)),
 
    train_cfg=dict(
        assigner=dict(
            type='MaxIoUAssigner',
            pos_iou_thr=0.5,
            neg_iou_thr=0.4,
            min_pos_iou=0,
            ignore_iof_thr=-1),
        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='nms', iou_threshold=0.5),
        max_per_img=200))  # 100
img_norm_cfg = dict(
    mean=[102.9801, 115.9465, 122.7717], std=[1.0, 1.0, 1.0], to_rgb=False)
optimizer_config = dict(
    _delete_=True, grad_clip=dict(max_norm=35, norm_type=2))
runner = dict(type='EpochBasedRunner', max_epochs=12)
`
My results are as follows:

2021-07-04 14:09:28,657 - mmdet - INFO -  Average Precision  (AP) @[ IoU=0.25      | area=   all | maxDets=200 ] = 0.0387
2021-07-04 14:09:28,657 - mmdet - INFO -  Average Precision  (AP) @[ IoU=0.25      | area=  tiny | maxDets=200 ] = 0.0419
2021-07-04 14:09:28,657 - mmdet - INFO -  Average Precision  (AP) @[ IoU=0.25      | area= tiny1 | maxDets=200 ] = 0.0000
2021-07-04 14:09:28,658 - mmdet - INFO -  Average Precision  (AP) @[ IoU=0.25      | area= tiny2 | maxDets=200 ] = 0.0198
2021-07-04 14:09:28,658 - mmdet - INFO -  Average Precision  (AP) @[ IoU=0.25      | area= tiny3 | maxDets=200 ] = 0.0898
2021-07-04 14:09:28,658 - mmdet - INFO -  Average Precision  (AP) @[ IoU=0.25      | area= small | maxDets=200 ] = 0.0872
2021-07-04 14:09:28,658 - mmdet - INFO -  Average Precision  (AP) @[ IoU=0.25      | area=reasonable | maxDets=200 ] = 0.1180
2021-07-04 14:09:28,658 - mmdet - INFO -  Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=200 ] = 0.0083
2021-07-04 14:09:28,658 - mmdet - INFO -  Average Precision  (AP) @[ IoU=0.50      | area=  tiny | maxDets=200 ] = 0.0099
2021-07-04 14:09:28,659 - mmdet - INFO -  Average Precision  (AP) @[ IoU=0.50      | area= tiny1 | maxDets=200 ] = 0.0000
2021-07-04 14:09:28,659 - mmdet - INFO -  Average Precision  (AP) @[ IoU=0.50      | area= tiny2 | maxDets=200 ] = 0.0000
2021-07-04 14:09:28,659 - mmdet - INFO -  Average Precision  (AP) @[ IoU=0.50      | area= tiny3 | maxDets=200 ] = 0.0102
2021-07-04 14:09:28,659 - mmdet - INFO -  Average Precision  (AP) @[ IoU=0.50      | area= small | maxDets=200 ] = 0.0051
2021-07-04 14:09:28,659 - mmdet - INFO -  Average Precision  (AP) @[ IoU=0.50      | area=reasonable | maxDets=200 ] = 0.0333
2021-07-04 14:09:28,659 - mmdet - INFO -  Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=200 ] = 0.0012
2021-07-04 14:09:28,659 - mmdet - INFO -  Average Precision  (AP) @[ IoU=0.75      | area=  tiny | maxDets=200 ] = 0.0002
2021-07-04 14:09:28,660 - mmdet - INFO -  Average Precision  (AP) @[ IoU=0.75      | area= tiny1 | maxDets=200 ] = 0.0000
2021-07-04 14:09:28,660 - mmdet - INFO -  Average Precision  (AP) @[ IoU=0.75      | area= tiny2 | maxDets=200 ] = 0.0000
2021-07-04 14:09:28,660 - mmdet - INFO -  Average Precision  (AP) @[ IoU=0.75      | area= tiny3 | maxDets=200 ] = 0.0002
2021-07-04 14:09:28,660 - mmdet - INFO -  Average Precision  (AP) @[ IoU=0.75      | area= small | maxDets=200 ] = 0.0000
2021-07-04 14:09:28,660 - mmdet - INFO -  Average Precision  (AP) @[ IoU=0.75      | area=reasonable | maxDets=200 ] = 0.0014
2021-07-04 14:09:28,660 - mmdet - INFO -  Average Recall     (AR) @[ IoU=0.25      | area=   all | maxDets=200 ] = 0.2699
2021-07-04 14:09:28,661 - mmdet - INFO -  Average Recall     (AR) @[ IoU=0.25      | area=  tiny | maxDets=200 ] = 0.0731
2021-07-04 14:09:28,661 - mmdet - INFO -  Average Recall     (AR) @[ IoU=0.25      | area= tiny1 | maxDets=200 ] = 0.0000
2021-07-04 14:09:28,661 - mmdet - INFO -  Average Recall     (AR) @[ IoU=0.25      | area= tiny2 | maxDets=200 ] = 0.0104
2021-07-04 14:09:28,661 - mmdet - INFO -  Average Recall     (AR) @[ IoU=0.25      | area= tiny3 | maxDets=200 ] = 0.1646
2021-07-04 14:09:28,661 - mmdet - INFO -  Average Recall     (AR) @[ IoU=0.25      | area= small | maxDets=200 ] = 0.5433
2021-07-04 14:09:28,661 - mmdet - INFO -  Average Recall     (AR) @[ IoU=0.25      | area=reasonable | maxDets=200 ] = 0.7332
2021-07-04 14:09:28,661 - mmdet - INFO -  Average Recall     (AR) @[ IoU=0.50      | area=   all | maxDets=200 ] = 0.1233
2021-07-04 14:09:28,662 - mmdet - INFO -  Average Recall     (AR) @[ IoU=0.50      | area=  tiny | maxDets=200 ] = 0.0081
2021-07-04 14:09:28,662 - mmdet - INFO -  Average Recall     (AR) @[ IoU=0.50      | area= tiny1 | maxDets=200 ] = 0.0000
2021-07-04 14:09:28,662 - mmdet - INFO -  Average Recall     (AR) @[ IoU=0.50      | area= tiny2 | maxDets=200 ] = 0.0000
2021-07-04 14:09:28,662 - mmdet - INFO -  Average Recall     (AR) @[ IoU=0.50      | area= tiny3 | maxDets=200 ] = 0.0191
2021-07-04 14:09:28,662 - mmdet - INFO -  Average Recall     (AR) @[ IoU=0.50      | area= small | maxDets=200 ] = 0.2072
2021-07-04 14:09:28,662 - mmdet - INFO -  Average Recall     (AR) @[ IoU=0.50      | area=reasonable | maxDets=200 ] = 0.4733
2021-07-04 14:09:28,662 - mmdet - INFO -  Average Recall     (AR) @[ IoU=0.75      | area=   all | maxDets=200 ] = 0.0084
2021-07-04 14:09:28,663 - mmdet - INFO -  Average Recall     (AR) @[ IoU=0.75      | area=  tiny | maxDets=200 ] = 0.0002
2021-07-04 14:09:28,663 - mmdet - INFO -  Average Recall     (AR) @[ IoU=0.75      | area= tiny1 | maxDets=200 ] = 0.0000
2021-07-04 14:09:28,663 - mmdet - INFO -  Average Recall     (AR) @[ IoU=0.75      | area= tiny2 | maxDets=200 ] = 0.0000
2021-07-04 14:09:28,663 - mmdet - INFO -  Average Recall     (AR) @[ IoU=0.75      | area= tiny3 | maxDets=200 ] = 0.0005
2021-07-04 14:09:28,663 - mmdet - INFO -  Average Recall     (AR) @[ IoU=0.75      | area= small | maxDets=200 ] = 0.0080
2021-07-04 14:09:28,663 - mmdet - INFO -  Average Recall     (AR) @[ IoU=0.75      | area=reasonable | maxDets=200 ] = 0.0400

@yinglang
Copy link
Contributor

yinglang commented Jul 5, 2021

You can try to remove GN in FCOS head by set model.bbox_head.norm_cfg=None.

And in addition, you can try adap FCOS, it will got significant improvement by following setting:

  1. using P2-P6 instead of P3-P7 for detection head, and set strides to (4, 8, 16, 32, 64) insetead of (8, 16, 32, 64, 128)
  2. set anchor to smaller one, such as (8, 16, 32, 64, 128) (FCOS also have implicit anchor named 'regress_ranges' in mmdetection).

for example

model = dict(
    pretrained='open-mmlab://detectron2/resnet50_caffe',
    neck=dict(
        start_level=0,   # add
    ),
    bbox_head=dict(
        norm_cfg=None,   # add
        num_classes=1,   # add
        strides=[4, 8, 16, 32, 64],  # add
        regress_ranges=((-1, 16), (16, 32), (32, 64), (64, 128), (128, INF)),  # add
        norm_on_bbox=True,
....

Although I have not runned this setting, I thought it should work.

@Hshuqin
Copy link
Author

Hshuqin commented Jul 5, 2021

You can try to remove GN in FCOS head by set model.bbox_head.norm_cfg=None.

And in addition, you can try adap FCOS, it will got significant improvement by following setting:

  1. using P2-P6 instead of P3-P7 for detection head, and set strides to (4, 8, 16, 32, 64) insetead of (8, 16, 32, 64, 128)
  2. set anchor to smaller one, such as (8, 16, 32, 64, 128) (FCOS also have implicit anchor named 'regress_ranges' in mmdetection).

for example

model = dict(
    pretrained='open-mmlab://detectron2/resnet50_caffe',
    neck=dict(
        start_level=0,   # add
    ),
    bbox_head=dict(
        norm_cfg=None,   # add
        num_classes=1,   # add
        strides=[4, 8, 16, 32, 64],  # add
        regress_ranges=((-1, 16), (16, 32), (32, 64), (64, 128), (128, INF)),  # add
        norm_on_bbox=True,
....

Although I have not runned this setting, I thought it should work.

thank you; To remove GN in FCOS head by set model.bbox_head.norm_cfg=None will obtain a relatively much higher accuracy;using P2-P6 instead of P3-P7 for detection head seems to be useless in my experiments

@yinglang
Copy link
Contributor

yinglang commented Jul 8, 2021

We have re-implemnet adap FCOS on TinyPerson, here is the performance table

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants