Giter VIP home page Giter VIP logo

Comments (16)

yangxue0827 avatar yangxue0827 commented on June 12, 2024 1

这个是我的训练日志。
20221111_103553.log

from h2rbox-mmrotate.

yangxue0827 avatar yangxue0827 commented on June 12, 2024

具体效果是多少?我这个方法是弱监督旋转检测,和有监督的算法比肯定效果差一些的。我自己在ssdd上做实验15x的效果对于弱监督来说还是可以的。

from h2rbox-mmrotate.

zhu011 avatar zhu011 commented on June 12, 2024
dataset_type = 'SARWSOODDataset'
data_root = 'data/ssdd/'
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='RResize_', img_scale=(800, 800)),
    dict(
        type='RRandomFlip',
        flip_ratio=[0.25, 0.25, 0.25],
        direction=['horizontal', 'vertical', 'diagonal'],
        version='le90'),
    dict(
        type='Normalize',
        mean=[123.675, 116.28, 103.53],
        std=[58.395, 57.12, 57.375],
        to_rgb=True),
    dict(type='Pad', size_divisor=1),
    dict(type='DefaultFormatBundle'),
    dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels'])
]
test_pipeline = [
    dict(type='LoadImageFromFile'),
    dict(
        type='MultiScaleFlipAug',
        img_scale=(800, 800),
        flip=False,
        transforms=[
            dict(type='RResize'),
            dict(
                type='Normalize',
                mean=[123.675, 116.28, 103.53],
                std=[58.395, 57.12, 57.375],
                to_rgb=True),
            dict(type='Pad', size_divisor=64),
            dict(type='DefaultFormatBundle'),
            dict(type='Collect', keys=['img'])
        ])
]
data = dict(
    samples_per_gpu=2,
    workers_per_gpu=2,
    train=dict(
        type='SARWSOODDataset',
        ann_file='data/ssdd/train/labelTxt/',
        img_prefix='data/ssdd/train/images/',
        pipeline=[
            dict(type='LoadImageFromFile'),
            dict(type='LoadAnnotations', with_bbox=True),
            dict(type='RResize_', img_scale=(800, 800)),
            dict(
                type='RRandomFlip',
                flip_ratio=[0.25, 0.25, 0.25],
                direction=['horizontal', 'vertical', 'diagonal'],
                version='le90'),
            dict(
                type='Normalize',
                mean=[123.675, 116.28, 103.53],
                std=[58.395, 57.12, 57.375],
                to_rgb=True),
            dict(type='Pad', size_divisor=1),
            dict(type='DefaultFormatBundle'),
            dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels'])
        ],
        version='le90'),
    val=dict(
        type='SARWSOODDataset',
        ann_file='data/ssdd/test/inshore/labelTxt/',
        img_prefix='data/ssdd/test/inshore/images/',
        pipeline=[
            dict(type='LoadImageFromFile'),
            dict(
                type='MultiScaleFlipAug',
                img_scale=(800, 800),
                flip=False,
                transforms=[
                    dict(type='RResize'),
                    dict(
                        type='Normalize',
                        mean=[123.675, 116.28, 103.53],
                        std=[58.395, 57.12, 57.375],
                        to_rgb=True),
                    dict(type='Pad', size_divisor=64),
                    dict(type='DefaultFormatBundle'),
                    dict(type='Collect', keys=['img'])
                ])
        ],
        version='le90'),
    test=dict(
        type='SARWSOODDataset',
        ann_file='data/ssdd/test/offshore/labelTxt/',
        img_prefix='data/ssdd/test/offshore/images/',
        pipeline=[
            dict(type='LoadImageFromFile'),
            dict(
                type='MultiScaleFlipAug',
                img_scale=(800, 800),
                flip=False,
                transforms=[
                    dict(type='RResize'),
                    dict(
                        type='Normalize',
                        mean=[123.675, 116.28, 103.53],
                        std=[58.395, 57.12, 57.375],
                        to_rgb=True),
                    dict(type='Pad', size_divisor=64),
                    dict(type='DefaultFormatBundle'),
                    dict(type='Collect', keys=['img'])
                ])
        ],
        version='le90'))
evaluation = dict(interval=5, metric='mAP')
optimizer = dict(
    type='AdamW',
    lr=0.0001,
    betas=(0.9, 0.999),
    weight_decay=0.05,
    paramwise_cfg=dict(
        custom_keys=dict(
            absolute_pos_embed=dict(decay_mult=0.0),
            relative_position_bias_table=dict(decay_mult=0.0),
            norm=dict(decay_mult=0.0))))
optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2))
lr_config = dict(
    policy='step',
    warmup='linear',
    warmup_iters=500,
    warmup_ratio=0.3333333333333333,
    step=[120, 165])
runner = dict(type='EpochBasedRunner', max_epochs=180)
checkpoint_config = dict(interval=30)
log_config = dict(
    interval=50,
    hooks=[dict(type='TextLoggerHook'),
           dict(type='TensorboardLoggerHook')])
dist_params = dict(backend='nccl')
log_level = 'INFO'
load_from = None
resume_from = None
workflow = [('train', 1)]
opencv_num_threads = 0
mp_start_method = 'fork'
angle_version = 'le90'
model = dict(
    type='H2RBox',
    crop_size=(800, 800),
    backbone=dict(
        type='ResNet',
        depth=50,
        num_stages=4,
        out_indices=(0, 1, 2, 3),
        frozen_stages=1,
        zero_init_residual=False,
        norm_cfg=dict(type='BN', requires_grad=True),
        norm_eval=True,
        style='pytorch',
        init_cfg=dict(type='Pretrained', checkpoint='torchvision://resnet50')),
    neck=dict(
        type='FPN',
        in_channels=[256, 512, 1024, 2048],
        out_channels=256,
        start_level=1,
        add_extra_convs='on_output',
        num_outs=5,
        relu_before_extra_convs=True),
    bbox_head=dict(
        type='H2RBoxHead',
        num_classes=1,
        in_channels=256,
        stacked_convs=4,
        feat_channels=256,
        strides=[8, 16, 32, 64, 128],
        center_sampling=True,
        center_sample_radius=1.5,
        norm_on_bbox=True,
        centerness_on_reg=True,
        separate_angle=False,
        scale_angle=True,
        reassigner='one2one',
        rect_classes=[],
        bbox_coder=dict(type='DistanceAnglePointCoder', angle_version='le90'),
        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_bbox_aug=dict(
            type='H2RBoxLoss',
            loss_weight=0.4,
            center_loss_cfg=dict(type='L1Loss', loss_weight=0.0),
            shape_loss_cfg=dict(type='IoULoss', loss_weight=1.0),
            angle_loss_cfg=dict(type='L1Loss', loss_weight=1.0)),
        loss_centerness=dict(
            type='CrossEntropyLoss', use_sigmoid=True, loss_weight=1.0)),
    train_cfg=None,
    test_cfg=dict(
        nms_pre=2000,
        min_bbox_size=0,
        score_thr=0.05,
        nms=dict(iou_thr=0.1),
        max_per_img=2000))
custom_imports = dict(imports=['h2rbox'], allow_failed_imports=False)
work_dir = './work_dirs/h2rbox_r50_adamw_fpn_15x_ssdd_le90'
auto_resume = False
gpu_ids = range(0, 1)

配置如上

from h2rbox-mmrotate.

zhu011 avatar zhu011 commented on June 12, 2024

class | gts | dets | recall | ap |
+-------+-----+------+--------+-------+
| ship | 131 | 222 | 0.260 | 0.148 |
+-------+-----+------+--------+-------+
| mAP | | | | 0.148 |
结果

from h2rbox-mmrotate.

yangxue0827 avatar yangxue0827 commented on June 12, 2024

用我给的配置文件多跑几次吧,有时候小数据集是不稳定。
我这里inshore和offshore的结果是63.76和89.59。

from h2rbox-mmrotate.

zhu011 avatar zhu011 commented on June 12, 2024

好的,谢谢您,我会试试。

from h2rbox-mmrotate.

zhu011 avatar zhu011 commented on June 12, 2024

在尝试h2rbox-atss,出现问题,配置如下,

_base_ = [
#     '../../_base_/datasets/ssdd.py',
#     '../../_base_/schedules/schedule_6x.py',
#     '../../_base_/default_runtime.py'
     '../_base_/datasets/ssdd.py', '../_base_/schedules/schedule_6x.py',
    '../_base_/default_runtime.py'
]
angle_version = 'le135'

# model settings
model = dict(
    type='H2RBoxATSS',
    crop_size=(1024, 1024),
    backbone=dict(
        type='ResNet',
        depth=50,
        num_stages=4,
        out_indices=(0, 1, 2, 3),
        frozen_stages=1,
        zero_init_residual=False,
        norm_cfg=dict(type='BN', requires_grad=True),
        norm_eval=True,
        style='pytorch',
        init_cfg=dict(type='Pretrained', checkpoint='torchvision://resnet50')),
    neck=dict(
        type='FPN',
        in_channels=[256, 512, 1024, 2048],
        out_channels=256,
        start_level=1,
        add_extra_convs='on_input',
        num_outs=5),
    bbox_head=dict(
        type='H2RBoxATSSHead',
        num_classes=15,
        in_channels=256,
        stacked_convs=4,
        feat_channels=256,
        assign_by_circumhbbox=None,
        rect_classes=[9, 11],
        angle_version=angle_version,
        anchor_generator=dict(
            type='RotatedAnchorGenerator',
            octave_base_scale=4,
            scales_per_octave=1,
            ratios=[1.0],
            strides=[8, 16, 32, 64, 128]),
        bbox_coder=dict(
            type='DeltaXYWHAOBBoxCoder',
            angle_range=angle_version,
            norm_factor=1,
            edge_swap=False,
            proj_xy=True,
            target_means=(.0, .0, .0, .0, .0),
            target_stds=(1.0, 1.0, 1.0, 1.0, 1.0)),
        loss_cls=dict(
            type='FocalLoss',
            use_sigmoid=True,
            gamma=2.0,
            alpha=0.25,
            loss_weight=1.0),
        reg_decoded_bbox=True,
        loss_bbox=dict(type='IoULoss', loss_weight=1.0),
        loss_bbox_aug=dict(
            type='H2RBoxATSSLoss',
            loss_weight=0.4,
            center_loss_cfg=dict(type='L1Loss', loss_weight=0.0),
            shape_loss_cfg=dict(type='IoULoss', loss_weight=1.0),
            angle_loss_cfg=dict(type='L1Loss', loss_weight=1.0))),
    train_cfg=dict(
        assigner=dict(
            type='ATSSObbAssigner',
            topk=9,
            angle_version=angle_version,
            iou_calculator=dict(type='RBboxOverlaps2D')),
        allowed_border=-1,
        pos_weight=-1,
        debug=False),
    test_cfg=dict(
        nms_pre=2000,
        min_bbox_size=0,
        score_thr=0.05,
        nms=dict(iou_thr=0.1),
        max_per_img=2000))
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='RResize_', img_scale=(800, 800)),
    # dict(type='FilterNoCenterObject', img_scale=(800, 800), crop_size=(800, 800)),
    # dict(type='RResize', img_scale=(800, 800)),
    dict(
        type='RRandomFlip',
        flip_ratio=[0.25, 0.25, 0.25],
        direction=['horizontal', 'vertical', 'diagonal'],
        version=angle_version),
    dict(type='Normalize', **img_norm_cfg),
    dict(type='Pad', size_divisor=1),
    dict(type='DefaultFormatBundle'),
    dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels'])
]

test_pipeline = [
    dict(type='LoadImageFromFile'),
    dict(
        type='MultiScaleFlipAug',
        img_scale=(800, 800),
        flip=False,
        transforms=[
            dict(type='RResize'),
            dict(type='Normalize', **img_norm_cfg),
            dict(type='Pad', size_divisor=64),
            dict(type='DefaultFormatBundle'),
            dict(type='Collect', keys=['img'])
        ])
]

data_root = 'data/ssdd/'
data = dict(
    train=dict(type='SARWSOODDataset', pipeline=train_pipeline,
               ann_file=data_root + 'train/labelTxt/',
               img_prefix=data_root + 'train/images/',
               version=angle_version),
    val=dict(type='SARWSOODDataset', pipeline=test_pipeline,
             ann_file=data_root + 'test/inshore/labelTxt/',
             img_prefix=data_root + 'test/inshore/images/',
             version=angle_version),
    test=dict(type='SARWSOODDataset', pipeline=test_pipeline,
              ann_file=data_root + 'test/offshore/labelTxt/',
              img_prefix=data_root + 'test/offshore/images/',
              version=angle_version))

# custom_imports = dict(
#     imports=['h2rbox'],
#     allow_failed_imports=False)


custom_imports = dict(
    imports=['h2rbox_atss'],
    allow_failed_imports=False)

log_config = dict(interval=50)
checkpoint_config = dict(interval=12)
optimizer = dict(lr=0.0005)
evaluation = dict(interval=5, metric='mAP')
**error:**
Traceback (most recent call last):
  File "tools/train.py", line 192, in <module>
    main()
  File "tools/train.py", line 188, in main
    meta=meta)
  File "/root/autodl-tmp/h2rbox-mmrotate/mmrotate/apis/train.py", line 141, in train_detector
    runner.run(data_loaders, cfg.workflow)
  File "/root/miniconda3/envs/open-mmlab/lib/python3.7/site-packages/mmcv/runner/epoch_based_runner.py", line 127, in run
    epoch_runner(data_loaders[i], **kwargs)
  File "/root/miniconda3/envs/open-mmlab/lib/python3.7/site-packages/mmcv/runner/epoch_based_runner.py", line 50, in train
    self.run_iter(data_batch, train_mode=True, **kwargs)
  File "/root/miniconda3/envs/open-mmlab/lib/python3.7/site-packages/mmcv/runner/epoch_based_runner.py", line 30, in run_iter
    **kwargs)
  File "/root/miniconda3/envs/open-mmlab/lib/python3.7/site-packages/mmcv/parallel/data_parallel.py", line 75, in train_step
    return self.module.train_step(*inputs[0], **kwargs[0])
  File "/root/miniconda3/envs/open-mmlab/lib/python3.7/site-packages/mmdet/models/detectors/base.py", line 248, in train_step
    losses = self(**data)
  File "/root/miniconda3/envs/open-mmlab/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/root/miniconda3/envs/open-mmlab/lib/python3.7/site-packages/mmcv/runner/fp16_utils.py", line 109, in new_func
    return old_func(*args, **kwargs)
  File "/root/miniconda3/envs/open-mmlab/lib/python3.7/site-packages/mmdet/models/detectors/base.py", line 172, in forward
    return self.forward_train(img, img_metas, **kwargs)
  File "/root/autodl-tmp/h2rbox-mmrotate/h2rbox_atss/h2rbox_atss_detector.py", line 98, in forward_train
    gt_bboxes_ignore)
  File "/root/autodl-tmp/h2rbox-mmrotate/h2rbox_atss/h2rbox_atss_head.py", line 111, in forward_train
    losses = self.loss(*loss_inputs, gt_bboxes_ignore=gt_bboxes_ignore)
  File "/root/miniconda3/envs/open-mmlab/lib/python3.7/site-packages/mmcv/runner/fp16_utils.py", line 197, in new_func
    return old_func(*args, **kwargs)
  File "/root/autodl-tmp/h2rbox-mmrotate/h2rbox_atss/h2rbox_atss_head.py", line 237, in loss
    label_channels=label_channels)
  File "/root/autodl-tmp/h2rbox-mmrotate/mmrotate/models/dense_heads/rotated_atss_head.py", line 209, in get_targets
    unmap_outputs=unmap_outputs)
  File "/root/miniconda3/envs/open-mmlab/lib/python3.7/site-packages/mmdet/core/utils/misc.py", line 30, in multi_apply
    return tuple(map(list, zip(*map_results)))
  File "/root/autodl-tmp/h2rbox-mmrotate/mmrotate/models/dense_heads/rotated_atss_head.py", line 83, in _get_targets_single
    None if self.sampling else gt_labels)
  File "/root/autodl-tmp/h2rbox-mmrotate/mmrotate/core/bbox/assigners/atss_obb_assigner.py", line 109, in assign
    self.topk, dim=0, largest=False)
RuntimeError: invalid argument 5: k not in range for dimension at /opt/conda/conda-bld/pytorch_1603729006826/work/aten/src/THC/generic/THCTensorTopK.cu:26

from h2rbox-mmrotate.

zhu011 avatar zhu011 commented on June 12, 2024

是不是我配置的有问题

from h2rbox-mmrotate.

yangxue0827 avatar yangxue0827 commented on June 12, 2024

类别数改成1

from h2rbox-mmrotate.

zhu011 avatar zhu011 commented on June 12, 2024
bbox_head=dict(
    type='H2RBoxATSSHead',
    num_classes=1,
    in_channels=256,
    stacked_convs=4,
    feat_channels=256,
    assign_by_circumhbbox=None,

rect_classes=[9, 11],

    rect_classes=[],
    angle_version=angle_version,已改,还是同样报错

from h2rbox-mmrotate.

yangxue0827 avatar yangxue0827 commented on June 12, 2024

h2rbox_atss_r50_adamw_fpn_6x_ssdd_le90.txt
h2rbox_atss_r50_fpn_6x_ssdd_le135.txt

建议改成15x

from h2rbox-mmrotate.

zhu011 avatar zhu011 commented on June 12, 2024

谢谢大佬,麻烦您了

from h2rbox-mmrotate.

yangxue0827 avatar yangxue0827 commented on June 12, 2024

另外mmrotate用的是07的评价指标(11点),很难上90,很多论文很高的指标是用的12的指标,需要你根据自己的需求改一下。
https://github.com/yangxue0827/h2rbox-mmrotate/blob/main/mmrotate/core/evaluation/eval_map.py#L130

from h2rbox-mmrotate.

zhu011 avatar zhu011 commented on June 12, 2024

好的,我会注意的,谢谢,这个为什么会报错,您配置文件修改的思路是什么,我想学习一下,然后试着自己在其他检测算法如S2anet等加入Atss试验一下

from h2rbox-mmrotate.

zhu011 avatar zhu011 commented on June 12, 2024

这个是我的训练日志。 20221111_103553.log
我的训练日志如下,config设置与您相同,但是试了十几次都不能达到您的效果,20230311_091812.log

from h2rbox-mmrotate.

yangxue0827 avatar yangxue0827 commented on June 12, 2024

#5
这里有人跑出来结果了。

from h2rbox-mmrotate.

Related Issues (19)

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.